Skip to content

Commit

Permalink
test(sbb-message): await image loading and fix import (#2831)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB authored Jun 25, 2024
1 parent 96d5b96 commit 73b3258
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/elements/message/message.visual.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import { html } from 'lit/static-html.js';

import {
describeViewports,
loadAssetAsBase64,
visualDiffDefault,
} from '../core/testing/private.js';
import { describeViewports, visualDiffDefault } from '../core/testing/private.js';
import { waitForImageReady } from '../core/testing.js';

import './message.js';
import '../image.js';
import '../button/secondary-button.js';

const imageUrl = import.meta.resolve('../core/testing/assets/lucerne.png');
await loadAssetAsBase64(imageUrl);

describe(`sbb-message`, () => {
describeViewports({ viewports: ['zero', 'medium'] }, () => {
Expand All @@ -30,6 +26,8 @@ describe(`sbb-message`, () => {
></sbb-secondary-button>
</sbb-message>
`);

await waitForImageReady(setup.snapshotElement.querySelector('sbb-image')!);
}),
);

Expand Down Expand Up @@ -64,6 +62,8 @@ describe(`sbb-message`, () => {
></sbb-secondary-button>
</sbb-message>
`);

await waitForImageReady(setup.snapshotElement.querySelector('sbb-image')!);
}),
);

Expand All @@ -77,6 +77,8 @@ describe(`sbb-message`, () => {
<p slot="legend">Error code: 0001</p>
</sbb-message>
`);

await waitForImageReady(setup.snapshotElement.querySelector('sbb-image')!);
}),
);

Expand All @@ -96,6 +98,8 @@ describe(`sbb-message`, () => {
></sbb-secondary-button>
</sbb-message>
`);

await waitForImageReady(setup.snapshotElement.querySelector('sbb-image')!);
}),
);
});
Expand Down

0 comments on commit 73b3258

Please sign in to comment.