|
1 | 1 | var ScatterGeo = require('@src/traces/scattergeo');
|
2 | 2 |
|
3 |
| -describe('Test scattergeo', function() { |
4 |
| - 'use strict'; |
5 | 3 |
|
6 |
| - describe('supplyDefaults', function() { |
7 |
| - var traceIn, |
8 |
| - traceOut; |
| 4 | +describe('Test scattergeo defaults', function() { |
| 5 | + var traceIn, |
| 6 | + traceOut; |
9 | 7 |
|
10 |
| - var defaultColor = '#444', |
11 |
| - layout = {}; |
| 8 | + var defaultColor = '#444', |
| 9 | + layout = {}; |
12 | 10 |
|
13 |
| - beforeEach(function() { |
14 |
| - traceOut = {}; |
15 |
| - }); |
| 11 | + beforeEach(function() { |
| 12 | + traceOut = {}; |
| 13 | + }); |
| 14 | + |
| 15 | + it('should slice lat if it it longer than lon', function() { |
| 16 | + traceIn = { |
| 17 | + lon: [-75], |
| 18 | + lat: [45, 45, 45] |
| 19 | + }; |
16 | 20 |
|
17 |
| - it('should slice lat if it it longer than lon', function() { |
18 |
| - traceIn = { |
19 |
| - lon: [-75], |
20 |
| - lat: [45, 45, 45] |
21 |
| - }; |
| 21 | + ScatterGeo.supplyDefaults(traceIn, traceOut, defaultColor, layout); |
| 22 | + expect(traceOut.lat).toEqual([45]); |
| 23 | + expect(traceOut.lon).toEqual([-75]); |
| 24 | + }); |
| 25 | + |
| 26 | + it('should slice lon if it it longer than lat', function() { |
| 27 | + traceIn = { |
| 28 | + lon: [-75, -75, -75], |
| 29 | + lat: [45] |
| 30 | + }; |
22 | 31 |
|
| 32 | + ScatterGeo.supplyDefaults(traceIn, traceOut, defaultColor, layout); |
| 33 | + expect(traceOut.lat).toEqual([45]); |
| 34 | + expect(traceOut.lon).toEqual([-75]); |
| 35 | + }); |
| 36 | + |
| 37 | + it('should not coerce lat and lon if locations is valid', function() { |
| 38 | + traceIn = { |
| 39 | + locations: ['CAN', 'USA'], |
| 40 | + lon: [20, 40], |
| 41 | + lat: [20, 40] |
| 42 | + }; |
| 43 | + |
| 44 | + ScatterGeo.supplyDefaults(traceIn, traceOut, defaultColor, layout); |
| 45 | + expect(traceOut.lon).toBeUndefined(); |
| 46 | + expect(traceOut.lat).toBeUndefined(); |
| 47 | + }); |
| 48 | + |
| 49 | + it('should make trace invisible if lon or lat is omitted and locations not given', function() { |
| 50 | + function testOne() { |
23 | 51 | ScatterGeo.supplyDefaults(traceIn, traceOut, defaultColor, layout);
|
24 |
| - expect(traceOut.lat).toEqual([45]); |
25 |
| - expect(traceOut.lon).toEqual([-75]); |
| 52 | + expect(traceOut.visible).toBe(false); |
| 53 | + } |
| 54 | + |
| 55 | + traceIn = { |
| 56 | + lat: [45, 45, 45] |
| 57 | + }; |
| 58 | + testOne(); |
| 59 | + |
| 60 | + traceIn = { |
| 61 | + lon: [-75, -75, -75] |
| 62 | + }; |
| 63 | + traceOut = {}; |
| 64 | + testOne(); |
| 65 | + |
| 66 | + traceIn = {}; |
| 67 | + traceOut = {}; |
| 68 | + testOne(); |
| 69 | + }); |
| 70 | +}); |
| 71 | + |
26 | 72 | });
|
27 | 73 |
|
28 |
| - it('should slice lon if it it longer than lat', function() { |
29 |
| - traceIn = { |
30 |
| - lon: [-75, -75, -75], |
31 |
| - lat: [45] |
32 |
| - }; |
33 | 74 |
|
34 |
| - ScatterGeo.supplyDefaults(traceIn, traceOut, defaultColor, layout); |
35 |
| - expect(traceOut.lat).toEqual([45]); |
36 |
| - expect(traceOut.lon).toEqual([-75]); |
37 | 75 | });
|
38 | 76 |
|
39 |
| - it('should not coerce lat and lon if locations is valid', function() { |
40 |
| - traceIn = { |
41 |
| - locations: ['CAN', 'USA'], |
42 |
| - lon: [20, 40], |
43 |
| - lat: [20, 40] |
44 |
| - }; |
45 | 77 |
|
46 |
| - ScatterGeo.supplyDefaults(traceIn, traceOut, defaultColor, layout); |
47 |
| - expect(traceOut.lon).toBeUndefined(); |
48 |
| - expect(traceOut.lat).toBeUndefined(); |
49 | 78 | });
|
50 | 79 |
|
51 |
| - it('should make trace invisible if lon or lat is omitted and locations not given', function() { |
52 |
| - function testOne() { |
53 |
| - ScatterGeo.supplyDefaults(traceIn, traceOut, defaultColor, layout); |
54 |
| - expect(traceOut.visible).toBe(false); |
55 |
| - } |
56 |
| - |
57 |
| - traceIn = { |
58 |
| - lat: [45, 45, 45] |
59 |
| - }; |
60 |
| - testOne(); |
61 |
| - |
62 |
| - traceIn = { |
63 |
| - lon: [-75, -75, -75] |
64 |
| - }; |
65 |
| - traceOut = {}; |
66 |
| - testOne(); |
67 |
| - |
68 |
| - traceIn = {}; |
69 |
| - traceOut = {}; |
70 |
| - testOne(); |
| 80 | + |
| 81 | + |
| 82 | + |
71 | 83 | });
|
72 | 84 | });
|
73 | 85 |
|
|
0 commit comments