Skip to content

Commit

Permalink
fix(banner): warning connotation when removable (VIV-1431) (#1647)
Browse files Browse the repository at this point in the history
* removable button is alternate only when not warning

* add test

* update snapshots
  • Loading branch information
rinaok authored Mar 27, 2024
1 parent 67af9e0 commit 8fe6bab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions libs/components/src/lib/banner/banner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,24 @@ describe('vwc-banner', () => {
);
});

it('should not be alternate when connotation is warning', async function () {
element.removable = true;
await elementUpdated(element);

expect(
element.shadowRoot
?.querySelector('.dismiss-button')
?.getAttribute('part')
).toEqual('vvd-theme-alternate');
element.connotation = Connotation.Warning;
await elementUpdated(element);
expect(
element.shadowRoot
?.querySelector('.dismiss-button')
?.getAttribute('part')
).toEqual('');
});

it('should add a remove button when true', async function () {
await toggleRemovable(element, true);
expect(
Expand Down
2 changes: 1 addition & 1 deletion libs/components/src/lib/banner/banner.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function renderDismissButton(buttonTag: string) {
<${buttonTag}
aria-label="${(x) =>
x.dismissButtonAriaLabel || x.locale.banner.dismissButtonLabel}"
part="vvd-theme-alternate"
part="${(x) => (x.connotation === 'warning' ? '' : 'vvd-theme-alternate')}"
size="condensed"
class="dismiss-button"
icon="close-line"
Expand Down

0 comments on commit 8fe6bab

Please sign in to comment.