mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
fix($sniffer): $sniffer to support non-vendor prefixes
This commit is contained in:
parent
d90a79632d
commit
be08c075bd
2 changed files with 50 additions and 1 deletions
|
|
@ -33,7 +33,7 @@ function $SnifferProvider() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
transitions = !!(vendorPrefix + 'Transition' in bodyStyle);
|
||||
transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -132,5 +132,54 @@ describe('$sniffer', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('should be false when there is no transition style', function() {
|
||||
module(function($provide) {
|
||||
var doc = {
|
||||
body : {
|
||||
style : {}
|
||||
}
|
||||
};
|
||||
$provide.value('$document', jqLite(doc));
|
||||
});
|
||||
inject(function($sniffer) {
|
||||
expect($sniffer.supportsTransitions).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be true with vendor-specific transitions', function() {
|
||||
module(function($provide) {
|
||||
var transitionStyle = '1s linear all';
|
||||
var doc = {
|
||||
body : {
|
||||
style : {
|
||||
WebkitTransition : transitionStyle,
|
||||
MozTransition : transitionStyle,
|
||||
OTransition : transitionStyle
|
||||
}
|
||||
}
|
||||
};
|
||||
$provide.value('$document', jqLite(doc));
|
||||
});
|
||||
inject(function($sniffer) {
|
||||
expect($sniffer.supportsTransitions).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be true with w3c-style transitions', function() {
|
||||
module(function($provide) {
|
||||
var doc = {
|
||||
body : {
|
||||
style : {
|
||||
transition : '1s linear all'
|
||||
}
|
||||
}
|
||||
};
|
||||
$provide.value('$document', jqLite(doc));
|
||||
});
|
||||
inject(function($sniffer) {
|
||||
expect($sniffer.supportsTransitions).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue