-
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.
refactor(sbb-image): apply styling according to coding standards (#2673)
- Loading branch information
1 parent
da23105
commit 42d28b5
Showing
11 changed files
with
302 additions
and
275 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* @web/test-runner snapshot v1 */ | ||
export const snapshots = {}; | ||
|
||
snapshots["sbb-image should render DOM"] = | ||
`<sbb-image | ||
aspect-ratio="16-9" | ||
border-radius="default" | ||
data-loaded="" | ||
> | ||
</sbb-image> | ||
`; | ||
/* end snapshot sbb-image should render DOM */ | ||
|
||
snapshots["sbb-image should render Shadow DOM"] = | ||
`<figure class="sbb-image__figure"> | ||
<div class="sbb-image__wrapper"> | ||
<img | ||
alt="" | ||
class="sbb-image__blurred" | ||
decoding="auto" | ||
height="562" | ||
loading="eager" | ||
width="1000" | ||
> | ||
<picture> | ||
<source | ||
media="(min-width: 64rem)" | ||
sizes="1200px" | ||
> | ||
<source | ||
media="(min-width: 37.5rem)" | ||
sizes="976px" | ||
> | ||
<source | ||
media="(max-width: 37.4375rem)" | ||
sizes="320px" | ||
> | ||
<img | ||
alt="" | ||
class="sbb-image__img" | ||
decoding="auto" | ||
height="562" | ||
loading="eager" | ||
width="1000" | ||
> | ||
</picture> | ||
</div> | ||
</figure> | ||
`; | ||
/* end snapshot sbb-image should render Shadow DOM */ | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { assert, expect } from '@open-wc/testing'; | ||
import { html } from 'lit/static-html.js'; | ||
|
||
import { fixture } from '../core/testing/private.js'; | ||
import { waitForCondition, waitForLitRender } from '../core/testing.js'; | ||
|
||
import { SbbImageElement } from './image.js'; | ||
|
||
describe(`sbb-image`, () => { | ||
let element: SbbImageElement; | ||
|
||
describe('should render', async () => { | ||
beforeEach(async () => { | ||
const url = `${location.protocol}//${location.host}/src/components/clock/assets/sbb_clock_face.svg`; | ||
element = await fixture(html`<sbb-image image-src=${url}></sbb-image>`); | ||
|
||
// Wait until the image is successfully loaded | ||
await waitForCondition(() => element.hasAttribute('data-loaded'), 30, 6000); | ||
await waitForLitRender(element); | ||
|
||
assert.instanceOf(element, SbbImageElement); | ||
}); | ||
|
||
it('DOM', async () => { | ||
await expect(element).dom.to.be.equalSnapshot({ ignoreAttributes: ['image-src'] }); | ||
}); | ||
|
||
it('Shadow DOM', async () => { | ||
await expect(element).shadowDom.to.be.equalSnapshot({ | ||
ignoreAttributes: ['src', 'srcset', 'fetchpriority'], | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.