-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sbb-button): fix high contrast styles (#2890)
- Loading branch information
1 parent
159baa0
commit 8f9237c
Showing
31 changed files
with
480 additions
and
152 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
54 changes: 54 additions & 0 deletions
54
src/elements/button/button-link/button-link.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,54 @@ | ||
import { html } from 'lit'; | ||
|
||
import { | ||
describeEach, | ||
describeViewports, | ||
visualDiffStandardStates, | ||
visualRegressionFixture, | ||
} from '../../core/testing/private.js'; | ||
|
||
import './button-link.js'; | ||
|
||
// We test only the differences to the sbb-button | ||
describe(`sbb-button-link`, () => { | ||
let root: HTMLElement; | ||
|
||
const cases = { | ||
disabled: [false, true], | ||
negative: [false, true], | ||
forcedColors: [false, true], | ||
}; | ||
|
||
describeViewports({ viewports: ['zero'] }, () => { | ||
describeEach(cases, ({ disabled, negative, forcedColors }) => { | ||
beforeEach(async function () { | ||
root = await visualRegressionFixture( | ||
html` | ||
<sbb-button-link | ||
?disabled=${disabled} | ||
?negative=${negative} | ||
icon-name="arrow-right-small" | ||
href="#" | ||
> | ||
Button | ||
</sbb-button-link> | ||
`, | ||
{ | ||
backgroundColor: negative ? 'var(--sbb-color-iron)' : undefined, | ||
focusOutlineDark: negative, | ||
forcedColors, | ||
}, | ||
); | ||
}); | ||
|
||
for (const state of visualDiffStandardStates) { | ||
it( | ||
state.name, | ||
state.with((setup) => { | ||
setup.withSnapshotElement(root); | ||
}), | ||
); | ||
} | ||
}); | ||
}); | ||
}); |
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
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
33 changes: 33 additions & 0 deletions
33
src/elements/button/button-static/button-static.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,33 @@ | ||
import { html } from 'lit'; | ||
|
||
import { | ||
describeViewports, | ||
visualDiffActive, | ||
visualDiffDefault, | ||
visualDiffHover, | ||
} from '../../core/testing/private.js'; | ||
|
||
import './button-static.js'; | ||
|
||
// We test only the differences to the sbb-button and sbb-button-link | ||
describe(`sbb-button-static`, () => { | ||
describeViewports({ viewports: ['zero'] }, () => { | ||
for (const forcedColors of [false, true]) { | ||
describe(`forcedColors=${forcedColors}`, () => { | ||
for (const state of [visualDiffDefault, visualDiffHover, visualDiffActive]) { | ||
it( | ||
state.name, | ||
state.with(async (setup) => { | ||
await setup.withFixture( | ||
html`<sbb-button-static icon-name="arrow-right-small">Button</sbb-button-static>`, | ||
{ | ||
forcedColors, | ||
}, | ||
); | ||
}), | ||
); | ||
} | ||
}); | ||
} | ||
}); | ||
}); |
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
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
Oops, something went wrong.