Skip to content

Commit 6e250e6

Browse files
joakbjerklangz
andauthored
refactor(GlobalStatus): use design tokens (#7054)
Co-authored-by: Anders Langseth <anderslangseth@gmail.com>
1 parent 0c52c1d commit 6e250e6

File tree

36 files changed

+156
-135
lines changed

36 files changed

+156
-135
lines changed

packages/dnb-eufemia/src/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.tsx.snap

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,18 @@ button.dnb-button::-moz-focus-inner {
11301130
padding-top: var(--spacing-xx-large);
11311131
padding-bottom: var(--spacing-xx-large);
11321132
}
1133+
.dnb-section--error {
1134+
--text-color: var(--token-color-text-neutral);
1135+
--background-color: var(--token-color-background-error-subtle);
1136+
}
1137+
.dnb-section--information, .dnb-section--success {
1138+
--text-color: var(--token-color-text-neutral);
1139+
--background-color: var(--token-color-background-info-subtle);
1140+
}
1141+
.dnb-section--warning {
1142+
--text-color: var(--token-color-text-neutral);
1143+
--background-color: var(--token-color-background-warning-subtle);
1144+
}
11331145
11341146
/*
11351147
* Breadcrumb component
-34 Bytes
Loading
Loading

packages/dnb-eufemia/src/components/global-status/__tests__/GlobalStatus.screenshot.test.ts

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,68 +10,73 @@ import {
1010

1111
const style = { width: '25rem' }
1212

13-
describe.each(['ui', 'sbanken'])('GlobalStatus for %s', (themeName) => {
14-
setupPageScreenshot({
15-
themeName,
16-
url: '/uilib/components/global-status/demos/',
17-
})
18-
19-
it('have to match the default state with custom content', async () => {
20-
const screenshot = await makeScreenshot({
21-
style,
22-
selector: '[data-visual-test="global-status"] .dnb-global-status',
23-
})
24-
expect(screenshot).toMatchImageSnapshot()
25-
})
26-
27-
it('have to match the information state and custom content', async () => {
28-
const screenshot = await makeScreenshot({
29-
style,
30-
selector:
31-
'[data-visual-test="global-status-information"] .dnb-global-status',
13+
describe.each(['ui', 'sbanken', 'carnegie'])(
14+
'GlobalStatus for %s',
15+
(themeName) => {
16+
setupPageScreenshot({
17+
themeName,
18+
url: '/uilib/components/global-status/demos/',
3219
})
33-
expect(screenshot).toMatchImageSnapshot()
34-
})
3520

36-
it('have to match the success state and custom content', async () => {
37-
const screenshot = await makeScreenshot({
38-
style,
39-
selector:
40-
'[data-visual-test="global-status-success"] .dnb-global-status',
21+
it('have to match the default state with custom content', async () => {
22+
const screenshot = await makeScreenshot({
23+
style,
24+
selector: '[data-visual-test="global-status"] .dnb-global-status',
25+
})
26+
expect(screenshot).toMatchImageSnapshot()
4127
})
42-
expect(screenshot).toMatchImageSnapshot()
43-
})
4428

45-
it('have to match the custom icon', async () => {
46-
const screenshot = await makeScreenshot({
47-
style,
48-
selector:
49-
'[data-visual-test="global-status-icon"] .dnb-global-status',
29+
it('have to match the info state and custom content', async () => {
30+
const screenshot = await makeScreenshot({
31+
style,
32+
selector:
33+
'[data-visual-test="global-status-information"] .dnb-global-status',
34+
})
35+
expect(screenshot).toMatchImageSnapshot()
5036
})
51-
expect(screenshot).toMatchImageSnapshot()
52-
})
5337

54-
if (themeName !== 'sbanken') {
55-
it('have to match the close button in focus state', async () => {
38+
it('have to match the success state and custom content', async () => {
5639
const screenshot = await makeScreenshot({
5740
style,
58-
selector: '[data-visual-test="global-status"] .dnb-global-status',
59-
simulateSelector:
60-
'[data-visual-test="global-status"] .dnb-global-status__close-button',
61-
simulate: 'focus',
41+
selector:
42+
'[data-visual-test="global-status-success"] .dnb-global-status',
6243
})
6344
expect(screenshot).toMatchImageSnapshot()
6445
})
6546

66-
it('have to match the close button in hover state', async () => {
47+
it('have to match the custom icon', async () => {
6748
const screenshot = await makeScreenshot({
6849
style,
69-
selector: '[data-visual-test="global-status"] .dnb-global-status',
70-
simulateSelector:
71-
'[data-visual-test="global-status"] .dnb-global-status__close-button',
72-
simulate: 'hover',
50+
selector:
51+
'[data-visual-test="global-status-icon"] .dnb-global-status',
7352
})
7453
expect(screenshot).toMatchImageSnapshot()
7554
})
55+
56+
if (themeName !== 'sbanken') {
57+
it('have to match the close button in focus state', async () => {
58+
const screenshot = await makeScreenshot({
59+
style,
60+
selector:
61+
'[data-visual-test="global-status"] .dnb-global-status',
62+
simulateSelector:
63+
'[data-visual-test="global-status"] .dnb-global-status__close-button',
64+
simulate: 'focus',
65+
})
66+
expect(screenshot).toMatchImageSnapshot()
67+
})
68+
69+
it('have to match the close button in hover state', async () => {
70+
const screenshot = await makeScreenshot({
71+
style,
72+
selector:
73+
'[data-visual-test="global-status"] .dnb-global-status',
74+
simulateSelector:
75+
'[data-visual-test="global-status"] .dnb-global-status__close-button',
76+
simulate: 'hover',
77+
})
78+
expect(screenshot).toMatchImageSnapshot()
79+
})
80+
}
7681
}
77-
})
82+
)
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)