Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Feb 12, 2024
1 parent 302da2e commit 6a0a96c
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 64 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@types/d3": "^7.4.3",
"@vitest/coverage-v8": "^1.2.2",
"autoprefixer": "^10.4.16",
"jsdom": "^24.0.0",
"netlify-cli": "^17.10.1",
"postcss": "^8.4.32",
"svelte": "^4.2.3",
Expand Down
8 changes: 5 additions & 3 deletions src/lib/__snapshots__/ColorLint.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ exports[`ColorLint - BackgroundDifferentiability 2`] = `
]
`;

exports[`ColorLint - ColorBlind 1`] = `"This palette is not colorblind friendly for deuteranopia color blindness (ie can't see green). The following pairs are undifferentiable: (#0078b4 and #8c69bc), (#ff7e0e and #c4bc27), (#3d9f2f and #da2827), (#e179c1 and #00becf)"`;
exports[`ColorLint - ColorBlind 1`] = `"This palette is not colorblind friendly for deuteranopia color blindness (ie can't see green). The following pairs are undifferentiable: (#0078b4 and #8c69bc, #ff7e0e and #c4bc27, #3d9f2f and #da2827, #e179c1 and #00becf)"`;

exports[`ColorLint - ColorBlind 2`] = `"This palette is not colorblind friendly for protanopia color blindness (ie can't see red). The following pairs are undifferentiable: (#0078b4 and #8c69bc), (#ff7e0e and #3d9f2f), (#da2827 and #8e564b)"`;
exports[`ColorLint - ColorBlind 2`] = `"This palette is not colorblind friendly for protanopia color blindness (ie can't see red). The following pairs are undifferentiable: (#0078b4 and #8c69bc, #ff7e0e and #3d9f2f, #da2827 and #8e564b)"`;

exports[`ColorLint - ColorBlind 3`] = `"This palette is not colorblind friendly for tritanopia color blindness (ie can't see blue). The following pairs are undifferentiable: (#ff7e0e and #e179c1), (#8c69bc and #7f7f7f)"`;
exports[`ColorLint - ColorBlind 3`] = `"This palette is not colorblind friendly for tritanopia color blindness (ie can't see blue). The following pairs are undifferentiable: (#ff7e0e and #e179c1, #8c69bc and #7f7f7f)"`;

exports[`ColorLint - ColorBlind 4`] = `"This palette is not colorblind friendly for grayscale color blindness . The following pairs are undifferentiable: (#0078b4 and #da2827, #0078b4 and #8c69bc, #0078b4 and #8e564b, #0078b4 and #7f7f7f, #ff7e0e and #3d9f2f, #ff7e0e and #e179c1, #ff7e0e and #c4bc27, #ff7e0e and #00becf, #3d9f2f and #8c69bc, #3d9f2f and #e179c1, #3d9f2f and #7f7f7f, #da2827 and #8c69bc, #da2827 and #8e564b, #da2827 and #7f7f7f, #8c69bc and #8e564b, #8c69bc and #7f7f7f, #e179c1 and #c4bc27, #e179c1 and #00becf, #c4bc27 and #00becf)"`;
27 changes: 0 additions & 27 deletions src/lib/lint-language/__snapshots__/ColorLint.test.ts.snap

This file was deleted.

3 changes: 2 additions & 1 deletion src/stores/built-in-lints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { JSONStringify } from "../lib/utils";
import type { TaskType } from "../lib/lints/ColorLint";

const toString = (x: LintProgram) => JSONStringify(JSON.stringify(x));
// @ts-ignore
const $schema = `${location.href}lint-schema.json`;

const blindTypes = [
Expand Down Expand Up @@ -126,7 +127,7 @@ const BUILT_INS: CustomLint[] = [
group: "accessibility",
description: `All colors in a palette should be differentiable by people with ${type} ${blindnessLabels[type]}. This is because if they are not, then they will not be differentiable from each other in some contexts.`,
level: "error" as const,
failMessage: `Some colors in this palette ({{blame}}) are not differentiable by people with ${type}.`,
failMessage: `This palette is not colorblind friendly for ${type} color blindness ${blindnessLabels[type]}. The following pairs are undifferentiable: ({{blame}})`,
id: `colorblind-friendly-${type}-built-in`,
blameMode: "pair" as const,
})),
Expand Down
7 changes: 7 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
plugins: [],
test: {
environment: "jsdom",
},
});
Loading

0 comments on commit 6a0a96c

Please sign in to comment.