Skip to content

Commit 63d8863

Browse files
committed
pull isPlainObject test into separate file
1 parent 4eca485 commit 63d8863

File tree

2 files changed

+47
-43
lines changed

2 files changed

+47
-43
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
var Plotly = require('../src/plotly');
2+
3+
describe('isPlainObject', function() {
4+
'use strict';
5+
6+
var isPlainObject = Plotly.Lib.isPlainObject;
7+
8+
function A() {}
9+
10+
var shouldPass = [
11+
{},
12+
{a: 'A', 'B': 'b'}
13+
];
14+
15+
var shouldFail = [
16+
A,
17+
new A(),
18+
document,
19+
window,
20+
null,
21+
undefined,
22+
[],
23+
'string',
24+
true,
25+
false,
26+
NaN,
27+
Infinity,
28+
/foo/,
29+
'\n',
30+
new Array(10),
31+
new Date(),
32+
new RegExp('foo'),
33+
new String('string')
34+
];
35+
36+
shouldPass.forEach(function(obj) {
37+
it('treats ' + JSON.stringify(obj) + ' as a plain object', function () {
38+
expect(isPlainObject(obj)).toBe(true);
39+
});
40+
});
41+
42+
shouldFail.forEach(function(obj) {
43+
it('treats ' + JSON.stringify(obj!==window ? obj: 'window') + ' as NOT a plain object', function () {
44+
expect(isPlainObject(obj)).toBe(false);
45+
});
46+
});
47+
});

shelly/plotlyjs/static/plotlyjs/tests/lib_test.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -622,47 +622,4 @@ describe('Test lib.js:', function() {
622622
});
623623
});
624624

625-
describe('isPlainObject', function() {
626-
var isPlainObject = Plotly.Lib.isPlainObject;
627-
628-
function A() {}
629-
630-
var shouldPass = [
631-
{},
632-
{a: 'A', 'B': 'b'}
633-
];
634-
635-
var shouldFail = [
636-
A,
637-
new A(),
638-
document,
639-
window,
640-
null,
641-
undefined,
642-
[],
643-
'string',
644-
true,
645-
false,
646-
NaN,
647-
Infinity,
648-
/foo/,
649-
'\n',
650-
new Array(10),
651-
new Date(),
652-
new RegExp('foo'),
653-
new String('string')
654-
];
655-
656-
shouldPass.forEach(function(obj) {
657-
it('treats ' + JSON.stringify(obj) + ' as a plain object', function () {
658-
expect(isPlainObject(obj)).toBe(true);
659-
});
660-
});
661-
662-
shouldFail.forEach(function(obj) {
663-
it('treats ' + JSON.stringify(obj!==window ? obj: 'window') + ' as NOT a plain object', function () {
664-
expect(isPlainObject(obj)).toBe(false);
665-
});
666-
});
667-
});
668625
});

0 commit comments

Comments
 (0)