Skip to content

Commit

Permalink
fix(core/message-bar): hide entire ix-message-bar and turn off user…
Browse files Browse the repository at this point in the history
…-interactions (#1695)
  • Loading branch information
matthiashader authored Feb 17, 2025
1 parent 8726afc commit 5cdd5e8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/core/src/components/message-bar/message-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@
ix-icon {
margin-top: $tiny-space;
}

.message-bar-hidden {
display: none;
}
}
2 changes: 1 addition & 1 deletion packages/core/src/components/message-bar/message-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class MessageBar {
opacity: [1, 0],
easing: 'easeOutSine',
complete: () => {
el.classList.add('d-none');
el.classList.add('message-bar-hidden');
this.closeAnimationCompleted.emit();
},
});
Expand Down
34 changes: 34 additions & 0 deletions packages/core/src/components/message-bar/test/message-bar.ct.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* SPDX-FileCopyrightText: 2025 Siemens AG
*
* SPDX-License-Identifier: MIT
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import { expect } from '@playwright/test';
import { test } from '@utils/test';

test.describe('ix-message-bar', () => {
test.beforeEach(async ({ mount }) => {
await mount(
`<ix-message-bar type="danger" dismissible>Content</ix-message-bar>`
);
});

test('emits closeAnimationCompleted event', async ({ page }) => {
const messageBar = page.locator('ix-message-bar');
const closeButton = messageBar.locator('[data-testid="close-btn"]');

const onCloseAnimationCompleted = messageBar.evaluate((element) => {
return new Promise<void>((resolve) => {
element.addEventListener('closeAnimationCompleted', () => resolve());
});
});
await closeButton.click();
await onCloseAnimationCompleted;

await expect(messageBar).not.toBeVisible();
});
});

0 comments on commit 5cdd5e8

Please sign in to comment.