Skip to content

Commit 8f0fb8c

Browse files
committed
chore: tweak tests
1 parent 913f94f commit 8f0fb8c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/test-contrast.mjs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ const getContrast = ( col, self, background ) => {
245245

246246
return {
247247
selfContrast,
248-
backgroundContrast
248+
backgroundContrast,
249+
colorWithAlfa: JSON.stringify(colorWithAlfa),
250+
self: JSON.stringify(self)
249251
};
250252
};
251253

@@ -594,10 +596,15 @@ const printViolations = (result) => {
594596

595597
if (count.violations > 0 || count.focus > 0) {
596598
/* eslint-disable no-console */
597-
console.log("Focus contrast WCAG violations:");
598-
console.dir(result.focusContrast, { depth: 3 });
599-
console.log("Text contrast WCAG AA errors:");
600-
console.dir(result.violations, { depth: 5 });
599+
if(count.focus > 0) {
600+
console.log("Focus contrast WCAG violations:");
601+
console.dir(result.focusContrast, { depth: 3 });
602+
}
603+
604+
if(count.violations > 0) {
605+
console.log("Text contrast WCAG AA errors:");
606+
console.dir(result.violations, { depth: 5 });
607+
}
601608

602609
console.error('A11y contrast checks fail.');
603610
process.exit(1);

0 commit comments

Comments
 (0)