@@ -3,6 +3,57 @@ import * as browser from '../../src/utils/browser'
33
44describe ( 'Browser Utilities' , ( ) => {
55
6+ describe ( 'getPrefixedStyleProperty()' , ( ) => {
7+
8+ beforeEach ( 'clear cache' , ( ) => {
9+ browser . getPrefixedStyleProperty . clearCache ( )
10+ } )
11+
12+ it ( 'should return unprefixed properties before prefixed' , ( ) => {
13+ const source = {
14+ transform : '' ,
15+ '-webkit-transform' : '' ,
16+ }
17+ const result = browser . getPrefixedStyleProperty ( 'transform' , source )
18+ expect ( result ) . to . equal ( 'transform' )
19+ } )
20+
21+ it ( 'should return prefixed property names' , ( ) => {
22+ const source = { '-webkit-transform' : '' }
23+ const result = browser . getPrefixedStyleProperty ( 'transform' , source )
24+ expect ( result ) . to . equal ( '-webkit-transform' )
25+ } )
26+
27+ it ( 'should return property names from cache when available' , ( ) => {
28+ const source = { '-webkit-transform' : '' }
29+ browser . getPrefixedStyleProperty ( 'transform' , source )
30+ const result = browser . getPrefixedStyleProperty ( 'transform' , { } )
31+ expect ( result ) . to . equal ( '-webkit-transform' )
32+ } )
33+
34+ it ( 'should throw a range error when no property is found' , ( ) => {
35+ let caught
36+ try {
37+ browser . getPrefixedStyleProperty ( 'transform' , { } )
38+ } catch ( error ) {
39+ caught = error
40+ }
41+ expect ( caught ) . to . exist
42+ expect ( caught ) . to . be . an . instanceof ( RangeError )
43+ } )
44+
45+ it ( 'should throw a type error if not passed a string' , ( ) => {
46+ let caught
47+ try {
48+ browser . getPrefixedStyleProperty ( null )
49+ } catch ( error ) {
50+ caught = error
51+ }
52+ expect ( caught ) . to . exist
53+ expect ( caught ) . to . be . an . instanceof ( TypeError )
54+ } )
55+ } )
56+
657 describe ( 'isMobile()' , ( ) => {
758
859 it ( 'should return true when passed a mobile user agent' , ( ) => {
0 commit comments