Skip to content

Commit 02eca97

Browse files
committed
revert Plots object in register,
- so that Plots is consistent from suite to suite.
1 parent d46ae26 commit 02eca97

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/jasmine/tests/register_test.js

+21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
var Plotly = require('@lib/index');
22

33
describe('the register function', function() {
4+
'use strict';
5+
6+
var Plots = Plotly.Plots;
7+
8+
beforeEach(function() {
9+
this.modulesKeys = Object.keys(Plots.modules);
10+
this.allTypesKeys = Object.keys(Plots.allTypes);
11+
this.allCategoriesKeys = Object.keys(Plots.allCategories);
12+
});
13+
14+
afterEach(function() {
15+
function revertObj(obj, initialKeys) {
16+
Object.keys(obj).forEach(function(k) {
17+
if(initialKeys.indexOf(k) === -1) delete obj[k];
18+
});
19+
}
20+
21+
revertObj(Plots.modules, this.modulesKeys);
22+
revertObj(Plots.allTypes, this.allTypesKeys);
23+
revertObj(Plots.allCategories, this.allCategoriesKeys);
24+
});
425

526
it('should throw an error when no argument is given', function() {
627
expect(function() {

0 commit comments

Comments
 (0)