Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sbb-message): fix image alignment #3305

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/elements/message/message.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

::slotted([slot='image']) {
display: block;
margin-inline: auto !important; // overrides '.sbb-figure' margin
margin-block: var(--sbb-message-image-margin-block) !important; // overrides '.sbb-figure' margin
width: 100%;
}
Expand Down
25 changes: 25 additions & 0 deletions src/elements/message/message.visual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,31 @@ describe(`sbb-message`, () => {
await waitForImageReady(setup.snapshotElement.querySelector(testCase.imgSelector)!);
}),
);

it(
`small image ${testCase.title}`,
visualDiffDefault.with(async (setup) => {
await setup.withFixture(html`
<style>
[slot='image'] {
width: 200px;
}
</style>
<sbb-message title-content="Unfortunately, an error has occurred.">
${testCase.imgTemplate()}
<p slot="subtitle">Please reload the page or try your search again later.</p>
<p slot="legend">Error code: 0001</p>
<sbb-secondary-button
slot="action"
icon-name="arrows-circle-small"
size="m"
></sbb-secondary-button>
</sbb-message>
`);

await waitForImageReady(setup.snapshotElement.querySelector(testCase.imgSelector)!);
}),
);
}

it(
Expand Down
Loading