@@ -122,6 +122,73 @@ describe('ShadowCss, keyframes and animations', () => {
122122 } ) ;
123123 } ) ;
124124
125+ it ( 'should handle (scope or not) animation definition containing some names which do not have a preceding space' , ( ) => {
126+ const COMPONENT_VARIABLE = '%COMP%' ;
127+ const HOST_ATTR = `_nghost-${ COMPONENT_VARIABLE } ` ;
128+ const CONTENT_ATTR = `_ngcontent-${ COMPONENT_VARIABLE } ` ;
129+ const css = `.test {
130+ animation:my-anim 1s,my-anim2 2s, my-anim3 3s,my-anim4 4s;
131+ }
132+
133+ @keyframes my-anim {
134+ 0% {color: red}
135+ 100% {color: blue}
136+ }
137+
138+ @keyframes my-anim2 {
139+ 0% {font-size: 1em}
140+ 100% {font-size: 1.2em}
141+ }
142+ ` ;
143+ const result = shim ( css , CONTENT_ATTR , HOST_ATTR ) ;
144+ const animationLineMatch = result . match ( / a n i m a t i o n : [ ^ ; ] + ; / ) ;
145+ let animationLine = '' ;
146+ if ( animationLineMatch ) {
147+ animationLine = animationLineMatch [ 0 ] ;
148+ }
149+ [ 'my-anim' , 'my-anim2' ] . forEach ( ( scoped ) =>
150+ expect ( animationLine ) . toContain ( `_ngcontent-%COMP%_${ scoped } ` ) ,
151+ ) ;
152+ [ 'my-anim3' , 'my-anim4' ] . forEach ( ( nonScoped ) => {
153+ expect ( animationLine ) . toContain ( nonScoped ) ;
154+ expect ( animationLine ) . not . toContain ( `_ngcontent-%COMP%_${ nonScoped } ` ) ;
155+ } ) ;
156+ } ) ;
157+
158+ it ( 'should handle (scope or not) animation definitions preceded by an erroneous comma' , ( ) => {
159+ const COMPONENT_VARIABLE = '%COMP%' ;
160+ const HOST_ATTR = `_nghost-${ COMPONENT_VARIABLE } ` ;
161+ const CONTENT_ATTR = `_ngcontent-${ COMPONENT_VARIABLE } ` ;
162+ const css = `.test {
163+ animation:, my-anim 1s,my-anim2 2s, my-anim3 3s,my-anim4 4s;
164+ }
165+
166+ @keyframes my-anim {
167+ 0% {color: red}
168+ 100% {color: blue}
169+ }
170+
171+ @keyframes my-anim2 {
172+ 0% {font-size: 1em}
173+ 100% {font-size: 1.2em}
174+ }
175+ ` ;
176+ const result = shim ( css , CONTENT_ATTR , HOST_ATTR ) ;
177+ const animationLineMatch = result . match ( / a n i m a t i o n : [ ^ ; ] + ; / ) ;
178+ let animationLine = '' ;
179+ if ( animationLineMatch ) {
180+ animationLine = animationLineMatch [ 0 ] ;
181+ }
182+ expect ( result ) . not . toContain ( 'animation:,' ) ;
183+ [ 'my-anim' , 'my-anim2' ] . forEach ( ( scoped ) =>
184+ expect ( animationLine ) . toContain ( `_ngcontent-%COMP%_${ scoped } ` ) ,
185+ ) ;
186+ [ 'my-anim3' , 'my-anim4' ] . forEach ( ( nonScoped ) => {
187+ expect ( animationLine ) . toContain ( nonScoped ) ;
188+ expect ( animationLine ) . not . toContain ( `_ngcontent-%COMP%_${ nonScoped } ` ) ;
189+ } ) ;
190+ } ) ;
191+
125192 it ( 'should handle (scope or not) multiple animation definitions in a single declaration' , ( ) => {
126193 const css = `
127194 div {
0 commit comments