1
|
|
|
var jsondash = require('../flask_jsondash/static/js/utils'); |
2
|
|
|
|
3
|
|
|
describe('serializeToJSON', function(){ |
4
|
|
|
it('should serialize properly', function(){ |
5
|
|
|
// TODO! |
6
|
|
|
}); |
7
|
|
|
}); |
8
|
|
|
|
9
|
|
|
describe('isOverride', function(){ |
10
|
|
|
it('should override values', function(){ |
11
|
|
|
expect(jsondash.util.isOverride({override: true})).toBe(true); |
12
|
|
|
expect(jsondash.util.isOverride({override: false})).toBe(false); |
13
|
|
|
}); |
14
|
|
|
}); |
15
|
|
|
|
16
|
|
|
describe('guid', function(){ |
17
|
|
|
it('should generated a guid', function(){ |
18
|
|
|
expect(jsondash.util.guid().length).toBe(36); |
19
|
|
|
}); |
20
|
|
|
}); |
21
|
|
|
|
22
|
|
|
describe('polygon', function(){ |
23
|
|
|
it('should create a polygon svg string', function(){ |
24
|
|
|
expect(jsondash.util.polygon(['30', '60'])).toBe('M30L60Z'); |
25
|
|
|
expect(jsondash.util.polygon([])).toBe('MZ'); |
26
|
|
|
}); |
27
|
|
|
}); |
28
|
|
|
|
29
|
|
|
describe('isD3Subtype', function(){ |
30
|
|
|
it('should recognize the correct d3 subtypes', function(){ |
31
|
|
|
expect(jsondash.util.isD3Subtype({type: 'dendrogram'})).toBe(true); |
32
|
|
|
expect(jsondash.util.isD3Subtype({type: 'voronoi'})).toBe(true); |
33
|
|
|
expect(jsondash.util.isD3Subtype({type: 'circlepack'})).toBe(true); |
34
|
|
|
expect(jsondash.util.isD3Subtype({type: 'treemap'})).toBe(true); |
35
|
|
|
expect(jsondash.util.isD3Subtype({type: 'radial-dendrogram'})).toBe(true); |
36
|
|
|
expect(jsondash.util.isD3Subtype({type: 'foo'})).toBe(false); |
37
|
|
|
expect(jsondash.util.isD3Subtype({type: null})).toBe(false); |
38
|
|
|
}); |
39
|
|
|
}); |
40
|
|
|
|
41
|
|
|
describe('isSparkline', function(){ |
42
|
|
|
it('should recognize the correct sparkline type', function(){ |
43
|
|
|
expect(jsondash.util.isSparkline('sparklines-foo')).toBe(true); |
44
|
|
|
expect(jsondash.util.isSparkline('smarkline-foo')).toBe(false); |
45
|
|
|
}); |
46
|
|
|
}); |
47
|
|
|
|
48
|
|
|
describe('getDigitSize', function(){ |
49
|
|
|
it('should resize the text based on digits', function(){ |
50
|
|
|
// TODO! |
51
|
|
|
}); |
52
|
|
|
}); |
53
|
|
|
|