aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/snifferSpec.js
diff options
context:
space:
mode:
authorMatias Niemelä2013-05-07 10:29:29 -0400
committerMisko Hevery2013-05-08 15:40:37 -0700
commit88c3480aff79e1ff5b1ed8bd7f1e05df8ea1e068 (patch)
tree1eb4e66c454fdb802d080096209c111e8d22b733 /test/ng/snifferSpec.js
parent0cb04e2e9171ca60d4779cb9e0b4fe73f0926ace (diff)
downloadangular.js-88c3480aff79e1ff5b1ed8bd7f1e05df8ea1e068.tar.bz2
feat($sniffer): Add support for supportsAnimations flag for detecting CSS Animations browser support
Diffstat (limited to 'test/ng/snifferSpec.js')
-rw-r--r--test/ng/snifferSpec.js67
1 files changed, 62 insertions, 5 deletions
diff --git a/test/ng/snifferSpec.js b/test/ng/snifferSpec.js
index 3a450e24..5cdc8fd9 100644
--- a/test/ng/snifferSpec.js
+++ b/test/ng/snifferSpec.js
@@ -124,11 +124,68 @@ describe('$sniffer', function() {
});
- describe('supportsTransitions', function() {
+ describe('animations', function() {
+ it('should be either true or false', function() {
+ inject(function($sniffer) {
+ expect($sniffer.animations).not.toBe(undefined);
+ });
+ });
+
+ it('should be false when there is no animation style', function() {
+ module(function($provide) {
+ var doc = {
+ body : {
+ style : {}
+ }
+ };
+ $provide.value('$document', jqLite(doc));
+ });
+ inject(function($sniffer) {
+ expect($sniffer.animations).toBe(false);
+ });
+ });
+
+ it('should be true with vendor-specific animations', function() {
+ module(function($provide) {
+ var animationStyle = 'some_animation 2s linear';
+ var doc = {
+ body : {
+ style : {
+ WebkitAnimation : animationStyle,
+ MozAnimation : animationStyle,
+ OAnimation : animationStyle
+ }
+ }
+ };
+ $provide.value('$document', jqLite(doc));
+ });
+ inject(function($sniffer) {
+ expect($sniffer.animations).toBe(true);
+ });
+ });
+
+ it('should be true with w3c-style animations', function() {
+ module(function($provide) {
+ var doc = {
+ body : {
+ style : {
+ animation : 'some_animation 2s linear'
+ }
+ }
+ };
+ $provide.value('$document', jqLite(doc));
+ });
+ inject(function($sniffer) {
+ expect($sniffer.animations).toBe(true);
+ });
+ });
+ });
+
+ describe('transitions', function() {
it('should be either true or false', function() {
inject(function($sniffer) {
- expect($sniffer.supportsTransitions).not.toBe(undefined);
+ expect($sniffer.transitions).not.toBe(undefined);
});
});
@@ -142,7 +199,7 @@ describe('$sniffer', function() {
$provide.value('$document', jqLite(doc));
});
inject(function($sniffer) {
- expect($sniffer.supportsTransitions).toBe(false);
+ expect($sniffer.transitions).toBe(false);
});
});
@@ -161,7 +218,7 @@ describe('$sniffer', function() {
$provide.value('$document', jqLite(doc));
});
inject(function($sniffer) {
- expect($sniffer.supportsTransitions).toBe(true);
+ expect($sniffer.transitions).toBe(true);
});
});
@@ -177,7 +234,7 @@ describe('$sniffer', function() {
$provide.value('$document', jqLite(doc));
});
inject(function($sniffer) {
- expect($sniffer.supportsTransitions).toBe(true);
+ expect($sniffer.transitions).toBe(true);
});
});