-
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.
- Loading branch information
1 parent
2bbe23d
commit 2bdd05c
Showing
3 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
src/elements/link/block-link-button/block-link-button.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,78 @@ | ||
import { html, nothing } from 'lit'; | ||
|
||
import { | ||
describeEach, | ||
describeViewports, | ||
visualDiffDefault, | ||
visualDiffStandardStates, | ||
} from '../../core/testing/private.js'; | ||
|
||
import './block-link-button.js'; | ||
|
||
describe(`sbb-block-link-button`, () => { | ||
const iconState = { | ||
iconPlacement: ['start', 'end'], | ||
slotted: [false, true], | ||
}; | ||
|
||
describeViewports({ viewports: ['zero', 'medium'] }, () => { | ||
for (const negative of [true, false]) { | ||
for (const state of visualDiffStandardStates) { | ||
it( | ||
state.name, | ||
state.with((setup) => { | ||
setup.withFixture( | ||
html`<sbb-block-link-button ?negative=${negative} | ||
>Travelcards & tickets</sbb-block-link-button | ||
>`, | ||
{ | ||
backgroundColor: negative ? 'var(--sbb-color-charcoal)' : undefined, | ||
}, | ||
); | ||
}), | ||
); | ||
} | ||
} | ||
|
||
describeEach(iconState, ({ iconPlacement, slotted }) => { | ||
it( | ||
visualDiffDefault.name, | ||
visualDiffDefault.with((setup) => { | ||
setup.withFixture(html` | ||
<sbb-block-link-button | ||
icon-name=${slotted ? nothing : 'chevron-small-right-small'} | ||
icon-placement=${iconPlacement} | ||
> | ||
${slotted | ||
? html`<sbb-icon slot="icon" name="chevron-small-left-small"></sbb-icon>` | ||
: nothing} | ||
Travelcards & tickets | ||
</sbb-block-link-button> | ||
`); | ||
}), | ||
); | ||
}); | ||
|
||
for (const size of ['xs', 's', 'm']) { | ||
it( | ||
`size=${size} ${visualDiffDefault.name}`, | ||
visualDiffDefault.with((setup) => { | ||
setup.withFixture( | ||
html`<sbb-block-link-button size=${size}>Travelcards & tickets</sbb-block-link-button>`, | ||
); | ||
}), | ||
); | ||
} | ||
|
||
it( | ||
`width=fixed ${visualDiffDefault.name}`, | ||
visualDiffDefault.with((setup) => { | ||
setup.withFixture( | ||
html`<sbb-block-link-button icon-name="chevron-small-right-small" style="width: 200px;"> | ||
A lot of link text to show what happens if there is not enough space. | ||
</sbb-block-link-button>`, | ||
); | ||
}), | ||
); | ||
}); | ||
}); |
81 changes: 81 additions & 0 deletions
81
src/elements/link/block-link-static/block-link-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,81 @@ | ||
import { html, nothing } from 'lit'; | ||
|
||
import { | ||
describeEach, | ||
describeViewports, | ||
visualDiffActive, | ||
visualDiffDefault, | ||
visualDiffHover, | ||
} from '../../core/testing/private.js'; | ||
|
||
import './block-link-static.js'; | ||
|
||
describe(`sbb-block-link-static`, () => { | ||
const iconState = { | ||
iconPlacement: ['start', 'end'], | ||
slotted: [false, true], | ||
}; | ||
|
||
describeViewports({ viewports: ['zero', 'medium'] }, () => { | ||
for (const negative of [true, false]) { | ||
for (const state of [visualDiffDefault, visualDiffActive, visualDiffHover]) { | ||
it( | ||
state.name, | ||
state.with((setup) => { | ||
setup.withFixture( | ||
html` <sbb-block-link-static ?negative="${negative}" | ||
>Travelcards & tickets</sbb-block-link-static | ||
>`, | ||
{ | ||
backgroundColor: negative ? 'var(--sbb-color-charcoal)' : undefined, | ||
}, | ||
); | ||
}), | ||
); | ||
} | ||
} | ||
|
||
describeEach(iconState, ({ iconPlacement, slotted }) => { | ||
it( | ||
visualDiffDefault.name, | ||
visualDiffDefault.with((setup) => { | ||
setup.withFixture(html` | ||
<sbb-block-link-static | ||
icon-name="${slotted ? nothing : 'chevron-small-right-small'}" | ||
icon-placement="${iconPlacement}" | ||
> | ||
${slotted | ||
? html` <sbb-icon slot="icon" name="chevron-small-left-small"></sbb-icon>` | ||
: nothing} | ||
Travelcards & tickets | ||
</sbb-block-link-static> | ||
`); | ||
}), | ||
); | ||
}); | ||
|
||
for (const size of ['xs', 's', 'm']) { | ||
it( | ||
`size=${size} ${visualDiffDefault.name}`, | ||
visualDiffDefault.with((setup) => { | ||
setup.withFixture( | ||
html` <sbb-block-link-static size="${size}" | ||
>Travelcards & tickets</sbb-block-link-static | ||
>`, | ||
); | ||
}), | ||
); | ||
} | ||
|
||
it( | ||
`width=fixed ${visualDiffDefault.name}`, | ||
visualDiffDefault.with((setup) => { | ||
setup.withFixture( | ||
html` <sbb-block-link-static icon-name="chevron-small-right-small" style="width: 200px;"> | ||
A lot of link text to show what happens if there is not enough space. | ||
</sbb-block-link-static>`, | ||
); | ||
}), | ||
); | ||
}); | ||
}); |
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,79 @@ | ||
import { html, nothing } from 'lit'; | ||
|
||
import { | ||
describeEach, | ||
describeViewports, | ||
visualDiffDefault, | ||
visualDiffStandardStates, | ||
} from '../../core/testing/private.js'; | ||
|
||
import './block-link.js'; | ||
|
||
describe(`sbb-block-link`, () => { | ||
const iconState = { | ||
iconPlacement: ['start', 'end'], | ||
slotted: [false, true], | ||
}; | ||
|
||
describeViewports({ viewports: ['zero', 'medium'] }, () => { | ||
for (const negative of [true, false]) { | ||
for (const state of visualDiffStandardStates) { | ||
it( | ||
state.name, | ||
state.with((setup) => { | ||
setup.withFixture( | ||
html`<sbb-block-link href="#" ?negative=${negative} | ||
>Travelcards & tickets</sbb-block-link | ||
>`, | ||
{ | ||
backgroundColor: negative ? 'var(--sbb-color-charcoal)' : undefined, | ||
}, | ||
); | ||
}), | ||
); | ||
} | ||
} | ||
|
||
describeEach(iconState, ({ iconPlacement, slotted }) => { | ||
it( | ||
visualDiffDefault.name, | ||
visualDiffDefault.with((setup) => { | ||
setup.withFixture(html` | ||
<sbb-block-link | ||
href="#" | ||
icon-name=${slotted ? nothing : 'chevron-small-right-small'} | ||
icon-placement=${iconPlacement} | ||
> | ||
${slotted | ||
? html`<sbb-icon slot="icon" name="chevron-small-left-small"></sbb-icon>` | ||
: nothing} | ||
Travelcards & tickets | ||
</sbb-block-link> | ||
`); | ||
}), | ||
); | ||
}); | ||
|
||
for (const size of ['xs', 's', 'm']) { | ||
it( | ||
`size=${size} ${visualDiffDefault.name}`, | ||
visualDiffDefault.with((setup) => { | ||
setup.withFixture( | ||
html`<sbb-block-link href="#" size=${size}>Travelcards & tickets</sbb-block-link>`, | ||
); | ||
}), | ||
); | ||
} | ||
|
||
it( | ||
`width=fixed ${visualDiffDefault.name}`, | ||
visualDiffDefault.with((setup) => { | ||
setup.withFixture( | ||
html`<sbb-block-link href="#" icon-name="chevron-small-right-small" style="width: 200px;"> | ||
A lot of link text to show what happens if there is not enough space. | ||
</sbb-block-link>`, | ||
); | ||
}), | ||
); | ||
}); | ||
}); |