Skip to content

Commit c5fc75c

Browse files
committed
test --uui-toast-notification-animation-duration inheritance
1 parent 11196ad commit c5fc75c

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

packages/uui-toast-notification-container/lib/uui-toast-notification-container.test.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { UUIToastNotificationContainerElement } from './uui-toast-notification-c
1919
function sleep(ms: number) {
2020
return new Promise(resolve => setTimeout(resolve, ms));
2121
}
22+
const ANIMATION_DURATION = 25;
2223

2324
describe('UUIToastNotificationContainerElement', () => {
2425
let element: UUIToastNotificationContainerElement;
@@ -30,6 +31,11 @@ describe('UUIToastNotificationContainerElement', () => {
3031
<uui-toast-notification-container></uui-toast-notification-container>
3132
`
3233
);
34+
// Just set the prop on the container, we will test that it inherits.
35+
element.style.setProperty(
36+
'--uui-toast-notification-animation-duration',
37+
ANIMATION_DURATION + 'ms'
38+
);
3339
toastElement = await fixture(
3440
html` <uui-toast-notification></uui-toast-notification> `
3541
);
@@ -49,13 +55,10 @@ describe('UUIToastNotificationContainerElement', () => {
4955
it('has a removeToast method', () => {
5056
expect(element).to.have.property('removeToast').that.is.a('function');
5157
});
52-
// TODO: test the method
5358

5459
it('has a closeToast method', () => {
5560
expect(element).to.have.property('closeToast').that.is.a('function');
5661
});
57-
58-
// TODO: Test the method
5962
});
6063

6164
describe('template', () => {
@@ -67,6 +70,17 @@ describe('UUIToastNotificationContainerElement', () => {
6770

6871
// Test appending a toast will open automatically.
6972
describe('child toast notifications', () => {
73+
it('appended toast notification inherits the animation duration custom property', async () => {
74+
element.appendChild(toastElement);
75+
76+
await elementUpdated(element);
77+
expect(
78+
getComputedStyle(toastElement).getPropertyValue(
79+
'--uui-toast-notification-animation-duration'
80+
)
81+
).to.be.equal(ANIMATION_DURATION + 'ms');
82+
});
83+
7084
it('appended toast notification will open automatically', async () => {
7185
element.appendChild(toastElement);
7286

0 commit comments

Comments
 (0)