forked from unconed/threestrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.spec.js
55 lines (36 loc) · 1.03 KB
/
plugin.spec.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
55
describe("plugin", function () {
it("registers a plugin", function () {
var spec = {};
expect(THREE.Bootstrap.Plugins.mockp1).toBeFalsy();
THREE.Bootstrap.registerPlugin('mockp1', spec);
expect(new THREE.Bootstrap.Plugins.mockp1()).toEqual(jasmine.any(THREE.Bootstrap.Plugin));
THREE.Bootstrap.unregisterPlugin('mockp1', spec);
expect(THREE.Bootstrap.Plugins.mockp1).toBeFalsy();
});
it("sets defaults", function () {
var captured = {};
var spec = {
install: function () {
captured = this.options;
},
defaults: {
foo: "bar",
foos: "bars",
},
};
THREE.Bootstrap.registerPlugin('mockp2', spec);
var options = {
init: false,
mockp2: {
foo: "baz",
},
plugins: ['mockp2'],
};
var three = new THREE.Bootstrap(options);
three.init();
expect(captured.foo).toBe('baz');
expect(captured.foos).toBe('bars');
three.destroy();
THREE.Bootstrap.unregisterPlugin('mockp2', spec);
});
});