-
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.
test(sbb-teaser-hero, sbb-teaser-paid): add visual spec (#2914)
- Loading branch information
Showing
6 changed files
with
313 additions
and
19 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
42 changes: 42 additions & 0 deletions
42
src/elements-experimental/teaser-hero/teaser-hero.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,42 @@ | ||
import { | ||
describeViewports, | ||
visualDiffDefault, | ||
visualDiffFocus, | ||
visualDiffHover, | ||
} from '@sbb-esta/lyne-elements/core/testing/private.js'; | ||
import { html } from 'lit'; | ||
|
||
import './teaser-hero.js'; | ||
import '@sbb-esta/lyne-elements/image.js'; | ||
|
||
const imageUrl = import.meta.resolve('../../elements/core/testing/assets/placeholder-image.png'); | ||
|
||
describe(`sbb-teaser-hero`, () => { | ||
describeViewports({ viewports: ['zero', 'micro', 'small', 'medium', 'wide'] }, () => { | ||
for (const state of [visualDiffDefault, visualDiffHover, visualDiffFocus]) { | ||
it( | ||
state.name, | ||
state.with(async (setup) => { | ||
await setup.withFixture(html` | ||
<sbb-teaser-hero href="#" link-content="Find out more" image-src=${imageUrl}> | ||
Break out and explore castles and palaces. | ||
</sbb-teaser-hero> | ||
`); | ||
}), | ||
); | ||
|
||
it( | ||
`slotted ${state.name}`, | ||
state.with(async (setup) => { | ||
await setup.withFixture(html` | ||
<sbb-teaser-hero href="#"> | ||
Break out and explore castles and palaces. | ||
<span slot="link-content">Find out more</span> | ||
<sbb-image slot="image" image-src=${imageUrl}></sbb-image> | ||
</sbb-teaser-hero> | ||
`); | ||
}), | ||
); | ||
} | ||
}); | ||
}); |
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
31 changes: 31 additions & 0 deletions
31
src/elements-experimental/teaser-paid/teaser-paid.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,31 @@ | ||
import { | ||
describeViewports, | ||
visualDiffDefault, | ||
visualDiffFocus, | ||
visualDiffHover, | ||
} from '@sbb-esta/lyne-elements/core/testing/private.js'; | ||
import { html } from 'lit'; | ||
|
||
import './teaser-paid.js'; | ||
import '@sbb-esta/lyne-elements/chip.js'; | ||
import '@sbb-esta/lyne-elements/image.js'; | ||
|
||
const imageUrl = import.meta.resolve('../../elements/core/testing/assets/placeholder-image.png'); | ||
|
||
describe(`sbb-teaser-paid`, () => { | ||
describeViewports({ viewports: ['zero', 'micro', 'small', 'medium', 'wide'] }, () => { | ||
for (const state of [visualDiffDefault, visualDiffHover, visualDiffFocus]) { | ||
it( | ||
state.name, | ||
state.with(async (setup) => { | ||
await setup.withFixture(html` | ||
<sbb-teaser-paid href="#"> | ||
<sbb-chip slot="chip">Label</sbb-chip> | ||
<sbb-image slot="image" image-src=${imageUrl}></sbb-image> | ||
</sbb-teaser-paid> | ||
`); | ||
}), | ||
); | ||
} | ||
}); | ||
}); |