Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion browser-bundle/15-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const __SNAP_STYLE_PROPS = [
"borderRightColor", "borderRightWidth", "borderRightStyle",
"borderTopColor", "borderTopWidth", "borderTopStyle", "bottom", "boxShadow",
"clip", "clip-path", "clipPath", "color", "colorScheme", "contain", "content",
"contentVisibility", "cssFloat", "direction", "display", "filter", "flexWrap", "float",
"contentVisibility", "cssFloat", "cursor", "direction", "display", "filter", "flexWrap", "float",
"fontFamily", "fontFeatureSettings", "fontSize", "fontStretch",
"fontStyle", "fontVariant", "fontVariantCaps", "fontWeight", "height",
"hyphens", "inlineSize", "inset", "insetBlock", "insetBlockEnd",
Expand Down
47 changes: 47 additions & 0 deletions crates/browser/tests/transient_opacity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,50 @@ fn the_url_engine_blends_only_the_opacity_at_rest() {
"only the four faded-at-rest cases should report, got {snippets:?}"
);
}

/// Text faded by a box a visitor's action changes. A stepper's inactive
/// item beside the active one at 1, with an opacity transition, is dim at
/// rest and reports as advisory (r13-t1), as does a checkout stepper's next
/// step; links all faded alike, a tab with no transition, an inactive tab
/// button, a clickable option, a faint modifier, identical class lists, a
/// lone parked badge, parked nav links, an inline design token and a number
/// written inline keep their severity; a box a
/// script parked in its `style` attribute at the start of a reveal is not
/// at rest and passes at its declared colour.
#[test]
fn the_url_engine_demotes_a_state_and_skips_a_parked_reveal() {
let Some(engine) = engine() else { return };
let port = serve();
let url = format!("http://127.0.0.1:{port}/low-contrast-resting-states.html");
let findings = engine.detect_url(&url, &ScanOptions::default()).expect("scan");
let contrast: Vec<(String, bool)> = findings
.iter()
.filter(|f| f.antipattern == "low-contrast")
.map(|f| (f.snippet.clone(), f.advisory == Some(true)))
.collect();

for (case, expected, advisory) in [
("inactive stepper item beside the active one", "text #b3b4b6 on #ffffff", true),
("footer links all faded alike", "text #9a9c9e on #ffffff", false),
("inactive tab with no transition", "text #b3b5b6 on #ffffff", false),
("inactive tab button beside the selected one", "text #9fa2a4 on #ffffff", false),
("a number written inline", "text #d2d4d5 on #ffffff", false),
("a lone badge parked inline", "text #b4b5b5 on #ffffff", false),
("nav links parked inline alike", "text #aaabab on #ffffff", false),
("a design token written inline", "text #ababab on #ffffff", false),
("a faint modifier on the dimmed box", "text #ababac on #ffffff", false),
("a clickable plan option", "text #abacac on #ffffff", false),
("identical classes, one dimmed inline", "text #acacad on #ffffff", false),
("a checkout stepper's next step", "text #adadad on #ffffff", true),
] {
assert!(
contrast.iter().any(|(s, a)| s.contains(expected) && *a == advisory),
"{case} should flag as `{expected}` (advisory {advisory}), got {contrast:?}"
);
}
assert_eq!(
contrast.len(),
12,
"the three parked reveals should not report, got {contrast:?}"
);
}
Loading
Loading