Skip to content

Commit

Permalink
chore(crate): add missing locales
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Oct 11, 2023
1 parent 29f06f3 commit 1aa7e6d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions accessibility-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "accessibility-rs"
version = "0.0.10"
version = "0.0.12-rc-4"
authors = ["The A11yWatch Project Developers", "Jeff Mendez <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Incredibly fast and precise universal web accessibility engine for Rust."
repository = "https://github.com/a11ywatch/accessibility-rs"
categories = ["accessibility"]
documentation = "https://docs.rs/accessibility-rs"
include = ["/src", "LICENSE_MIT", "LICENSE_APACHE"]
include = ["/src", "LICENSE_MIT", "LICENSE_APACHE", "locales"]

[features]
default = []
Expand Down
20 changes: 10 additions & 10 deletions accessibility-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,28 @@ pub use crate::engine::audit::auditor::Auditor;
pub use crate::engine::issue::Issue;
pub use accessibility_scraper::ElementRef;

i18n!();
i18n!("locales");

/// configs for the audit
#[derive(Default)]
pub struct AuditConfig {
pub struct AuditConfig<'a> {
/// the html source code
pub html: &'static str,
pub html: &'a str,
/// the css rules to apply
pub css: &'static str,
pub css: &'a str,
/// extract bounding box of elements
pub bounding_box: bool,
/// the locale of the audit translations
pub locale: &'static str,
pub locale: &'a str,
}

impl AuditConfig {
impl<'a> AuditConfig<'a> {
/// a new audit configuration
pub fn new(
html: &'static str,
css: &'static str,
html: &'a str,
css: &'a str,
bounding_box: bool,
locale: &'static str,
locale: &'a str,
) -> Self {
AuditConfig {
html,
Expand All @@ -89,7 +89,7 @@ impl AuditConfig {
}

/// audit a web page passing the html and css rules.
pub fn audit(config: &AuditConfig) -> Vec<Issue> {
pub fn audit(config: AuditConfig) -> Vec<Issue> {
let document = accessibility_scraper::Html::parse_document(config.html);
let mut nth_index_cache = selectors::NthIndexCache::from(Default::default());
let auditor = Auditor::new(
Expand Down
2 changes: 1 addition & 1 deletion accessibility-rs/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use mocks::mock;

#[test]
fn _audit() {
let _ = accessibility_rs::audit(&AuditConfig::new(
let _ = accessibility_rs::audit(AuditConfig::new(
mock::MOCK_WEBSITE_HTML,
&mock::MOCK_CSS_RULES,
false,
Expand Down
14 changes: 7 additions & 7 deletions accessibility-rs/tests/unit/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::mocks::mock;
#[test]
/// missing title element
fn _audit_missing_title() {
let audit = accessibility_rs::audit(&AuditConfig::basic(mock::MOCK_WEBSITE_HTML));
let audit = accessibility_rs::audit(AuditConfig::basic(mock::MOCK_WEBSITE_HTML));
let mut valid = true;

for x in &audit {
Expand All @@ -23,7 +23,7 @@ fn _audit_missing_title() {
#[test]
/// meta refresh redirect
fn _audit_meta_refresh() {
let audit = accessibility_rs::audit(&AuditConfig::basic(
let audit = accessibility_rs::audit(AuditConfig::basic(
r###"<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Do not use this!</title>
Expand Down Expand Up @@ -51,7 +51,7 @@ fn _audit_meta_refresh() {

assert_eq!(valid, false);

let audit = accessibility_rs::audit(&AuditConfig::basic(
let audit = accessibility_rs::audit(AuditConfig::basic(
r###"<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>HTML Techniques for WCAG 2.0</title>
Expand All @@ -76,7 +76,7 @@ fn _audit_meta_refresh() {
#[test]
/// no blink elements
fn _audit_blink_found() {
let audit = accessibility_rs::audit(&AuditConfig::basic(
let audit = accessibility_rs::audit(AuditConfig::basic(
r###"<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Do not use this!</title>
Expand All @@ -101,7 +101,7 @@ fn _audit_blink_found() {
#[test]
/// iframe missing title
fn _iframe_missing_title() {
let audit = accessibility_rs::audit(&AuditConfig {
let audit = accessibility_rs::audit(AuditConfig {
html: r###"<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>A simple frameset document</title>
Expand Down Expand Up @@ -149,7 +149,7 @@ fn _iframe_missing_title() {
false,
"en",
);
let audit = accessibility_rs::audit(&config);
let audit = accessibility_rs::audit(config);
let mut valid = true;

for x in &audit {
Expand All @@ -175,7 +175,7 @@ fn _iframe_missing_title() {
"en",
);

let audit = accessibility_rs::audit(&config);
let audit = accessibility_rs::audit(config);
let mut valid = true;

for x in &audit {
Expand Down

0 comments on commit 1aa7e6d

Please sign in to comment.