-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(label): add a11y; visual tests (#1529)
- Loading branch information
1 parent
e4705a5
commit 5069982
Showing
604 changed files
with
1,923 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { html } from "@open-wc/testing"; | ||
import { runComponentTests } from "../../test/test-utils"; | ||
import "../../index"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const labelTemplate = ({ component, testid }: any) => { | ||
return html` | ||
<fieldset data-testid="${testid}" class="p8 ws3">${component}</fieldset> | ||
`; | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const getChildren = (status?: any) => { | ||
const typeClass = | ||
status && status !== "base" ? `s-label--status__${status}` : ""; | ||
return ` | ||
Example label | ||
${ | ||
status | ||
? ` | ||
<span class="s-label--status ${typeClass}">${ | ||
status ?? "no type" | ||
}</span> | ||
` | ||
: "" | ||
} | ||
`; | ||
}; | ||
|
||
describe("label", () => { | ||
runComponentTests({ | ||
type: "a11y", | ||
baseClass: `s-label`, | ||
modifiers: { | ||
primary: ["sm", "md", "lg", "xl"], | ||
}, | ||
children: { | ||
"default": getChildren(), | ||
"status": getChildren("base"), | ||
"status-beta": getChildren("beta"), | ||
"status-new": getChildren("new"), | ||
"status-required": getChildren("required"), | ||
}, | ||
tag: "label", | ||
template: ({ component, testid }) => | ||
labelTemplate({ component, testid }), | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { html } from "@open-wc/testing"; | ||
import { runComponentTests } from "../../test/test-utils"; | ||
import "../../index"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const labelTemplate = ({ component, testid, isDisabled }: any) => { | ||
return html` | ||
<fieldset | ||
data-testid="${testid}" | ||
class="p8 ws3" | ||
?disabled="${isDisabled}" | ||
> | ||
${component} | ||
</fieldset> | ||
`; | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const getChildren = (text: string, status?: any) => { | ||
const typeClass = | ||
status && status !== "base" ? `s-label--status__${status}` : ""; | ||
return ` | ||
${text} | ||
${ | ||
status | ||
? ` | ||
<span class="s-label--status ${typeClass}">${ | ||
status ?? "no type" | ||
}</span> | ||
` | ||
: "" | ||
} | ||
`; | ||
}; | ||
|
||
describe("label", () => { | ||
[true, false].forEach((isDisabled) => { | ||
const text = isDisabled ? "Disabled label" : "Example label"; | ||
|
||
runComponentTests({ | ||
type: "visual", | ||
baseClass: `s-label`, | ||
modifiers: { | ||
primary: ["sm", "md", "lg", "xl"], | ||
}, | ||
children: isDisabled | ||
? { | ||
"disabled": getChildren(text), | ||
"disabled-status": getChildren(text, "base"), | ||
"disabled-status-beta": getChildren(text, "beta"), | ||
"disabled-status-new": getChildren(text, "new"), | ||
"disabled-status-required": getChildren(text, "required"), | ||
} | ||
: { | ||
"default": getChildren(text), | ||
"status": getChildren(text, "base"), | ||
"status-beta": getChildren(text, "beta"), | ||
"status-new": getChildren(text, "new"), | ||
"status-required": getChildren(text, "required"), | ||
}, | ||
tag: "label", | ||
template: ({ component, testid }) => | ||
labelTemplate({ component, testid, isDisabled }), | ||
}); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-disabled-status-beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-disabled-status-new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-disabled-status-required.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-disabled-status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-lg-disabled-status-beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-lg-disabled-status-new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-lg-disabled-status-required.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-lg-disabled-status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-lg-status-beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-lg-status-required.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-md-disabled-status-beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-md-disabled-status-new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-md-disabled-status-required.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-md-disabled-status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-md-status-beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-md-status-required.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-sm-disabled-status-beta.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-sm-disabled-status-new.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-sm-disabled-status-required.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-sm-disabled-status.png
Oops, something went wrong.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-sm-status-beta.png
Oops, something went wrong.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-sm-status-required.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-status-required.png
Oops, something went wrong.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-xl-disabled-status-beta.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-xl-disabled-status-new.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-xl-disabled-status-required.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-xl-disabled-status.png
Oops, something went wrong.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-xl-status-beta.png
Oops, something went wrong.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-dark-xl-status-required.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-highcontrast-dark-disabled-status-beta.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-highcontrast-dark-disabled-status-new.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...nshots/Chromium/baseline/s-label-highcontrast-dark-disabled-status-required.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-highcontrast-dark-disabled-status.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-highcontrast-dark-disabled.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...enshots/Chromium/baseline/s-label-highcontrast-dark-lg-disabled-status-beta.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-highcontrast-dark-lg-disabled-status-new.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...ots/Chromium/baseline/s-label-highcontrast-dark-lg-disabled-status-required.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-highcontrast-dark-lg-disabled-status.png
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
screenshots/Chromium/baseline/s-label-highcontrast-dark-lg-disabled.png
Oops, something went wrong.
Oops, something went wrong.