-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdefine.js
More file actions
47 lines (44 loc) · 1.44 KB
/
define.js
File metadata and controls
47 lines (44 loc) · 1.44 KB
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
const Keyframes = require('../dist/keyframes').default;
const assert = require('assert');
describe('Define', () => {
beforeEach(async () => {
await browser.evaluate(() => {
Keyframes.clearRules();
});
});
describe('#define()', () => {
it('Should define css and add to header', async () => {
const stylesheet = await browser.evaluate(() => {
Keyframes.define({
name: 'ball-roll',
from: {
transform: 'rotate(0deg)',
backgroundColor: 'red',
width: 10,
height: 0
},
});
return Keyframes.sheet.cssRules[0].cssText;
});
const expected = `@keyframes ball-roll {
0% { transform: rotate(0deg); background-color: red; width: 10px; height: 0px; }
}`;
assert.equal(expected, stylesheet);
});
});
describe('#addToRuleCache()', () => {
it('Should add defined css keys to a cache', () => {
Keyframes.addToRuleCache({
name: "test",
from: {
width: 1
},
to: {
width: 2,
height: 1
}
});
assert.deepEqual(Keyframes.ruleCache, { test: ['width', 'height'] });
});
});
});