|
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('getDigitSize', function(){ |
|
30
|
|
|
it('should resize the text based on digits', function(){ |
|
31
|
|
|
// TODO! |
|
32
|
|
|
}); |
|
33
|
|
|
}); |
|
34
|
|
|
|
|
35
|
|
|
describe('translateStr', function(){ |
|
36
|
|
|
it('should create the string for a svg translation value', function(){ |
|
37
|
|
|
expect(jsondash.util.translateStr(10, 20)).toBe('translate(10,20)'); |
|
38
|
|
|
expect(jsondash.util.translateStr('50%', '50%')).toBe('translate(50%,50%)'); |
|
39
|
|
|
}); |
|
40
|
|
|
}); |
|
41
|
|
|
|
|
42
|
|
|
describe('scaleStr', function(){ |
|
43
|
|
|
it('should create the string for a svg scale value', function(){ |
|
44
|
|
|
expect(jsondash.util.scaleStr(10, 20)).toBe('scale(10,20)'); |
|
45
|
|
|
expect(jsondash.util.scaleStr('50%', '50%')).toBe('scale(50%,50%)'); |
|
46
|
|
|
}); |
|
47
|
|
|
}); |
|
48
|
|
|
|