From ef5bc6c7c3336a64bae64fe9739cb1789907c906 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Fri, 28 Jun 2013 12:06:36 +0200 Subject: fix($sniffer): detect transition/animation on older Android browsers The stock Android browser doesn't support the current for-in body/style detection for animations and transitions but we can manually fix this. This is useful for PhoneGap web-views or traditional web-apps using the stock browser. --- test/ng/snifferSpec.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'test') diff --git a/test/ng/snifferSpec.js b/test/ng/snifferSpec.js index 5cdc8fd9..c9d0d5a8 100644 --- a/test/ng/snifferSpec.js +++ b/test/ng/snifferSpec.js @@ -179,6 +179,28 @@ describe('$sniffer', function() { expect($sniffer.animations).toBe(true); }); }); + + it('should be true on android with older body style properties', function() { + module(function($provide) { + var doc = { + body : { + style : { + webkitAnimation: '' + } + } + }; + var win = { + navigator: { + userAgent: 'android 2' + } + }; + $provide.value('$document', jqLite(doc)); + $provide.value('$window', win); + }); + inject(function($sniffer) { + expect($sniffer.animations).toBe(true); + }); + }); }); describe('transitions', function() { @@ -238,5 +260,27 @@ describe('$sniffer', function() { }); }); + it('should be true on android with older body style properties', function() { + module(function($provide) { + var doc = { + body : { + style : { + webkitTransition: '' + } + } + }; + var win = { + navigator: { + userAgent: 'android 2' + } + }; + $provide.value('$document', jqLite(doc)); + $provide.value('$window', win); + }); + inject(function($sniffer) { + expect($sniffer.transitions).toBe(true); + }); + }); + }); }); -- cgit v1.2.3