@@ -19,6 +19,7 @@ import { UUIToastNotificationContainerElement } from './uui-toast-notification-c
19
19
function sleep ( ms : number ) {
20
20
return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
21
21
}
22
+ const ANIMATION_DURATION = 25 ;
22
23
23
24
describe ( 'UUIToastNotificationContainerElement' , ( ) => {
24
25
let element : UUIToastNotificationContainerElement ;
@@ -30,6 +31,11 @@ describe('UUIToastNotificationContainerElement', () => {
30
31
< uui-toast-notification-container > </ uui-toast-notification-container >
31
32
`
32
33
) ;
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
+ ) ;
33
39
toastElement = await fixture (
34
40
html ` < uui-toast-notification > </ uui-toast-notification > `
35
41
) ;
@@ -49,13 +55,10 @@ describe('UUIToastNotificationContainerElement', () => {
49
55
it ( 'has a removeToast method' , ( ) => {
50
56
expect ( element ) . to . have . property ( 'removeToast' ) . that . is . a ( 'function' ) ;
51
57
} ) ;
52
- // TODO: test the method
53
58
54
59
it ( 'has a closeToast method' , ( ) => {
55
60
expect ( element ) . to . have . property ( 'closeToast' ) . that . is . a ( 'function' ) ;
56
61
} ) ;
57
-
58
- // TODO: Test the method
59
62
} ) ;
60
63
61
64
describe ( 'template' , ( ) => {
@@ -67,6 +70,17 @@ describe('UUIToastNotificationContainerElement', () => {
67
70
68
71
// Test appending a toast will open automatically.
69
72
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
+
70
84
it ( 'appended toast notification will open automatically' , async ( ) => {
71
85
element . appendChild ( toastElement ) ;
72
86
0 commit comments