-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sbb-visual-checkbox): fix high contrast mode of indeterminate sta…
…te (#2845)
- Loading branch information
1 parent
06112a4
commit f7e5adb
Showing
3 changed files
with
61 additions
and
2 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
51 changes: 51 additions & 0 deletions
51
src/elements/visual-checkbox/visual-checkbox.visual.spec.ts
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,51 @@ | ||
import { html } from 'lit'; | ||
|
||
import { | ||
describeEach, | ||
describeViewports, | ||
visualDiffDefault, | ||
visualRegressionFixture, | ||
} from '../core/testing/private.js'; | ||
|
||
import './visual-checkbox.js'; | ||
|
||
describe(`sbb-visual-checkbox`, () => { | ||
const cases = { | ||
state: [ | ||
{ indeterminate: undefined, checked: true }, | ||
{ indeterminate: undefined, checked: false }, | ||
{ indeterminate: true, checked: true }, | ||
], | ||
disabled: [false, true], | ||
negative: [false, true], | ||
forcedColors: [false, true], | ||
}; | ||
|
||
describeViewports({ viewports: ['zero'] }, () => { | ||
let root: HTMLElement; | ||
|
||
describeEach(cases, ({ state, disabled, negative, forcedColors }) => { | ||
beforeEach(async function () { | ||
root = await visualRegressionFixture( | ||
html`<sbb-visual-checkbox | ||
?indeterminate=${state.indeterminate} | ||
?checked=${state.checked} | ||
?disabled=${disabled} | ||
?negative=${negative} | ||
></sbb-visual-checkbox>`, | ||
{ | ||
forcedColors, | ||
backgroundColor: negative ? 'var(--sbb-color-black)' : undefined, | ||
}, | ||
); | ||
}); | ||
|
||
it( | ||
visualDiffDefault.name, | ||
visualDiffDefault.with((setup) => { | ||
setup.withSnapshotElement(root); | ||
}), | ||
); | ||
}); | ||
}); | ||
}); |