@@ -3,41 +3,14 @@ describe('Alert Group Animations Demo Test', () => {
33 cy . visit ( 'http://localhost:3000/alert-group-animations-demo-nav-link' ) ;
44 } ) ;
55
6- it ( 'Renders alert group item with animation' , ( ) => {
6+ it ( 'Renders alert group item with animation classes ' , ( ) => {
77 cy . clock ( ) ;
88 cy . get ( '#add-alert-button' ) . click ( ) ;
9- cy . get ( '.pf-v6-c-alert-group__item' ) . then ( ( $groupItem ) => {
10- const currentItem = $groupItem . get ( 0 ) ;
11- const height = currentItem . offsetHeight ;
12- expect ( height ) . to . equal ( 0 ) ;
13- } ) ;
9+ cy . get ( '.pf-v6-c-alert-group__item' ) . should ( 'have.class' , 'pf-m-offstage-top' ) ;
1410 cy . tick ( 1000 ) ;
15- cy . get ( '.pf-v6-c-alert-group__item' ) . then ( ( $groupItem ) => {
16- const currentItem = $groupItem . get ( 0 ) ;
17- const height = currentItem . offsetHeight ;
18- expect ( height ) . to . be . greaterThan ( 0 ) ;
19- } ) ;
20- cy . clock ( ) . invoke ( 'restore' ) ;
21- cy . get ( '#alert-close-button' ) . click ( { waitForAnimations : true } ) ;
22- cy . get ( '.pf-v6-c-alert' ) . should ( 'not.exist' ) ;
23- } ) ;
24-
25- it ( 'Removes alert group item with animation' , ( ) => {
26- let left : number ;
27- cy . clock ( ) ;
28- cy . get ( '#add-alert-button' ) . click ( ) ;
29- cy . tick ( 1000 ) ;
30- cy . get ( '.pf-v6-c-alert-group__item' ) . then ( ( $groupItem ) => {
31- const currentItem = $groupItem . get ( 0 ) ;
32- left = currentItem . getBoundingClientRect ( ) . left ;
33- } ) ;
11+ cy . get ( '.pf-v6-c-alert-group__item' ) . should ( 'not.have.class' , 'pf-m-offstage-top' ) ;
3412 cy . get ( '#alert-close-button' ) . click ( ) ;
35- cy . tick ( 50 ) ;
36- cy . get ( '.pf-v6-c-alert-group__item' ) . then ( ( $groupItem ) => {
37- const currentItem = $groupItem . get ( 0 ) ;
38- const leftAfterAnimation = currentItem . getBoundingClientRect ( ) . left ;
39-
40- expect ( left ) . to . be . lessThan ( leftAfterAnimation ) ;
41- } ) ;
13+ cy . tick ( 5 ) ;
14+ cy . get ( '.pf-v6-c-alert-group__item' ) . should ( 'have.class' , 'pf-m-offstage-right' ) ;
4215 } ) ;
4316} ) ;
0 commit comments