-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
54 lines (44 loc) · 1.28 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var expect = require('chai').expect;
var stub = require('sinon').stub;
var preficks = require('./index');
var props = {
MS: 'msTransform',
MOZ: 'MozAppearance',
WEBKIT: 'webkitBoxReflect',
SUPPORTED: 'display'
};
var reactProps = {
MOZ: 'MozAppearance',
WEBKIT: 'WebkitBoxReflect'
};
var mock = Object.keys(props).reduce(function(acc, prop) {
acc[props[prop]] = true;
return acc;
}, {});
GLOBAL.document = {
createElement: function() {
return {
style: mock
};
}
};
describe('preficks()', function() {
it('should return unprefixed if supported', function() {
expect(preficks(props.SUPPORTED)).to.equal(props.SUPPORTED);
});
it('should check for and return ms prefix', function() {
expect(preficks('transform')).to.equal(props.MS);
});
it('should check for and return moz prefix', function() {
expect(preficks('appearance')).to.equal(props.MOZ);
});
it('should return capital Moz if second param set to true', function() {
expect(preficks('appearance', true)).to.equal(reactProps.MOZ);
});
it('should check for and return webkit prefix', function() {
expect(preficks('boxReflect')).to.equal(props.WEBKIT);
});
it('should return capital Webkit if second param set to true', function() {
expect(preficks('boxReflect', true)).to.equal(reactProps.WEBKIT);
});
});