@@ -11,7 +11,7 @@ import {
1111} from 'angular2/test_lib' ;
1212import { ShadowCss } from 'angular2/src/render/dom/shadow_dom/shadow_css' ;
1313
14- import { RegExpWrapper , StringWrapper } from 'angular2/src/facade/lang' ;
14+ import { RegExpWrapper , StringWrapper , isPresent } from 'angular2/src/facade/lang' ;
1515import { DOM } from 'angular2/src/dom/dom_adapter' ;
1616
1717export function main ( ) {
@@ -56,18 +56,22 @@ export function main() {
5656 expect ( s ( css , 'a' ) ) . toEqual ( expected ) ;
5757 } ) ;
5858
59- it ( 'should handle keyframes rules' , ( ) => {
60- var css = '@keyframes foo {0% {transform: translate(-50%) scaleX(0);}}' ;
61- var passRe = RegExpWrapper . create (
62- '@keyframes foo {\\s*0% {\\s*transform:translate\\(-50%\\) scaleX\\(0\\);\\s*}\\s*}' ) ;
63- expect ( RegExpWrapper . test ( passRe , s ( css , 'a' ) ) ) . toEqual ( true ) ;
64- } ) ;
59+ // Check that the browser supports unprefixed CSS animation
60+ if ( isPresent ( DOM . defaultDoc ( ) . body . style ) &&
61+ isPresent ( DOM . defaultDoc ( ) . body . style . animationName ) ) {
62+ it ( 'should handle keyframes rules' , ( ) => {
63+ var css = '@keyframes foo {0% {transform: translate(-50%) scaleX(0);}}' ;
64+ var passRe = RegExpWrapper . create (
65+ '@keyframes foo {\\s*0% {\\s*transform:translate\\(-50%\\) scaleX\\(0\\);\\s*}\\s*}' ) ;
66+ expect ( RegExpWrapper . test ( passRe , s ( css , 'a' ) ) ) . toEqual ( true ) ;
67+ } ) ;
68+ }
6569
6670 if ( DOM . getUserAgent ( ) . indexOf ( 'AppleWebKit' ) > - 1 ) {
6771 it ( 'should handle -webkit-keyframes rules' , ( ) => {
68- var css = '@-webkit-keyframes foo {0% {transform: translate(-50%) scaleX(0);}}' ;
72+ var css = '@-webkit-keyframes foo {0% {-webkit- transform: translate(-50%) scaleX(0);}}' ;
6973 var passRe = RegExpWrapper . create (
70- '@-webkit-keyframes foo {\\s*0% {\\s*transform:translate\\(-50%\\) scaleX\\(0\\);\\s*}}' ) ;
74+ '@-webkit-keyframes foo {\\s*0% {\\s*(-webkit-)* transform:translate\\(-50%\\) scaleX\\(0\\);\\s*}}' ) ;
7175 expect ( RegExpWrapper . test ( passRe , s ( css , 'a' ) ) ) . toEqual ( true ) ;
7276 } ) ;
7377 }
0 commit comments