@@ -54,6 +54,8 @@ describe('DiagramSounding class, import via default', () => {
54
54
assert . ok ( Object . keys ( s . options . hodograph . style ) . length > 1 , 'style' ) ;
55
55
assert . equal ( s . options . hodograph . minPressure , undefined , 'hodograph.minPressure' ) ;
56
56
assert . equal ( s . options . hodograph . maxPressure , undefined , 'hodograph.maxPressure' ) ;
57
+ assert . ok ( s . options . hodograph . segments instanceof Array , 'hodograph.segments' ) ;
58
+ assert . equal ( s . options . hodograph . segments . length , 0 , 'hodograph.segments' ) ;
57
59
assert . equal ( Object . keys ( s . options . parcels ) . length , 2 , 'length parcels options' ) ;
58
60
assert . ok ( 'default' in s . options . parcels , 'default' ) ;
59
61
assert . equal ( Object . keys ( s . options . parcels . default ) . length , 3 , 'length default options' ) ;
@@ -84,7 +86,16 @@ describe('DiagramSounding class, import via default', () => {
84
86
width : 2
85
87
} ,
86
88
minPressure : 300 ,
87
- maxPressure : 900
89
+ maxPressure : 900 ,
90
+ segments : [ {
91
+ visible : false ,
92
+ minPressure : 500 ,
93
+ maxPressure : 800 ,
94
+ style : {
95
+ color : 'red' ,
96
+ width : 3
97
+ }
98
+ } ]
88
99
} ,
89
100
parcels : {
90
101
default : {
@@ -142,6 +153,14 @@ describe('DiagramSounding class, import via default', () => {
142
153
assert . equal ( s . options . hodograph . maxPressure , 900 , 'hodograph.maxPressure' ) ;
143
154
assert . equal ( s . options . hodograph . style . color , 'black' , 'color' ) ;
144
155
assert . equal ( s . options . hodograph . style . width , 2 , 'width' ) ;
156
+ assert . ok ( s . options . hodograph . segments instanceof Array , 'hodograph.segments' ) ;
157
+ assert . equal ( s . options . hodograph . segments . length , 1 , 'hodograph.segments' ) ;
158
+ assert . equal ( s . options . hodograph . segments [ 0 ] . minPressure , 500 , 'hodograph.segments[0].minPressure' ) ;
159
+ assert . equal ( s . options . hodograph . segments [ 0 ] . maxPressure , 800 , 'hodograph.segments[0].maxPressure' ) ;
160
+ assert . equal ( s . options . hodograph . segments [ 0 ] . visible , false , 'hodograph.segments[0].visible' ) ;
161
+ assert . equal ( Object . keys ( s . options . hodograph . segments [ 0 ] . style ) . length , 2 , 'keys hodograph.segments[0].style' ) ;
162
+ assert . equal ( s . options . hodograph . segments [ 0 ] . style . color , 'red' , 'hodograph.segments[0].style.color' ) ;
163
+ assert . equal ( s . options . hodograph . segments [ 0 ] . style . width , 3 , 'hodograph.segments[0].style.width' ) ;
145
164
assert . equal ( Object . keys ( s . options . parcels ) . length , 3 , 'length parcels options' ) ;
146
165
assert . ok ( ! s . options . parcels . default . visible , 'default.visible' ) ;
147
166
assert . equal ( Object . keys ( s . options . parcels . default ) . length , 3 , 'length default parcels options' ) ;
@@ -208,7 +227,20 @@ describe('DiagramSounding class, import via default', () => {
208
227
hodograph : {
209
228
visible : true ,
210
229
style : { color : 'green' } ,
211
- minPressure : 200
230
+ minPressure : 200 ,
231
+ segments : [ {
232
+ minPressure : 300 ,
233
+ maxPressure : 500 ,
234
+ style : {
235
+ color : 'orange'
236
+ }
237
+ } , {
238
+ minPressure : 500 ,
239
+ maxPressure : 700 ,
240
+ style : {
241
+ color : 'pink'
242
+ }
243
+ } ]
212
244
} ,
213
245
parcels : {
214
246
visible : true ,
@@ -247,6 +279,14 @@ describe('DiagramSounding class, import via default', () => {
247
279
assert . equal ( s . options . hodograph . style . width , '1' , 'width' ) ;
248
280
assert . equal ( s . options . hodograph . minPressure , 200 , 'hodograph.minPressure' ) ;
249
281
assert . equal ( s . options . hodograph . maxPressure , undefined , 'hodograph.maxPressure' ) ;
282
+ assert . ok ( s . options . hodograph . segments instanceof Array , 'hodograph.segments' ) ;
283
+ assert . equal ( s . options . hodograph . segments . length , 2 , 'hodograph.segments' ) ;
284
+ assert . equal ( s . options . hodograph . segments [ 0 ] . minPressure , 300 , 'hodograph.segments[0].minPressure' ) ;
285
+ assert . equal ( s . options . hodograph . segments [ 0 ] . maxPressure , 500 , 'hodograph.segments[0].maxPressure' ) ;
286
+ assert . equal ( s . options . hodograph . segments [ 0 ] . visible , true , 'hodograph.segments[0].visible' ) ;
287
+ assert . equal ( Object . keys ( s . options . hodograph . segments [ 0 ] . style ) . length , 2 , 'keys hodograph.segments[0].style' ) ;
288
+ assert . equal ( s . options . hodograph . segments [ 0 ] . style . color , 'orange' , 'hodograph.segments[0].style.color' ) ;
289
+ assert . equal ( s . options . hodograph . segments [ 0 ] . style . width , 1 , 'hodograph.segments[0].style.width' ) ;
250
290
assert . ok ( ! s . options . parcels . default . visible , 'visible' ) ;
251
291
assert . equal ( s . options . parcels . default . temp . style . color , 'gray' , 'color' ) ;
252
292
assert . ok ( ! s . options . parcels . default . dewp . visible , 'visible' ) ;
@@ -258,6 +298,47 @@ describe('DiagramSounding class, import via default', () => {
258
298
assert . ok ( s . visible , 'visible' ) ;
259
299
assert . equal ( changeOptionsCounter , 2 , 'changeOptionsCounter' ) ;
260
300
assert . equal ( changeVisibleCounter , 2 , 'changeVisibleCounter' ) ;
301
+ s . update ( {
302
+ hodograph : {
303
+ segments : [ {
304
+ minPressure : 850 ,
305
+ maxPressure : 1000 ,
306
+ style : {
307
+ color : 'violet'
308
+ }
309
+ } ]
310
+ }
311
+ } ) ;
312
+ assert . equal ( s . options . hodograph . style . color , 'green' , 'color' ) ;
313
+ assert . equal ( s . options . hodograph . style . width , '1' , 'width' ) ;
314
+ assert . equal ( s . options . hodograph . minPressure , 200 , 'hodograph.minPressure' ) ;
315
+ assert . equal ( s . options . hodograph . maxPressure , undefined , 'hodograph.maxPressure' ) ;
316
+ assert . ok ( s . options . hodograph . segments instanceof Array , 'hodograph.segments' ) ;
317
+ assert . equal ( s . options . hodograph . segments . length , 1 , 'hodograph.segments' ) ;
318
+ assert . equal ( s . options . hodograph . segments [ 0 ] . minPressure , 850 , 'hodograph.segments[0].minPressure' ) ;
319
+ assert . equal ( s . options . hodograph . segments [ 0 ] . maxPressure , 1000 , 'hodograph.segments[0].maxPressure' ) ;
320
+ assert . equal ( s . options . hodograph . segments [ 0 ] . visible , true , 'hodograph.segments[0].visible' ) ;
321
+ assert . equal ( Object . keys ( s . options . hodograph . segments [ 0 ] . style ) . length , 2 , 'keys hodograph.segments[0].style' ) ;
322
+ assert . equal ( s . options . hodograph . segments [ 0 ] . style . color , 'violet' , 'hodograph.segments[0].style.color' ) ;
323
+ assert . equal ( s . options . hodograph . segments [ 0 ] . style . width , 1 , 'hodograph.segments[0].style.width' ) ;
324
+ s . update ( {
325
+ hodograph : {
326
+ minPressure : undefined ,
327
+ maxPressure : undefined
328
+ }
329
+ } ) ;
330
+ assert . equal ( s . options . hodograph . style . color , 'green' , 'color' ) ;
331
+ assert . equal ( s . options . hodograph . style . width , '1' , 'width' ) ;
332
+ assert . equal ( s . options . hodograph . minPressure , undefined , 'hodograph.minPressure' ) ;
333
+ assert . equal ( s . options . hodograph . maxPressure , undefined , 'hodograph.maxPressure' ) ;
334
+ assert . ok ( s . options . hodograph . segments instanceof Array , 'hodograph.segments' ) ;
335
+ assert . equal ( s . options . hodograph . segments . length , 1 , 'hodograph.segments' ) ;
336
+ assert . equal ( s . options . hodograph . segments [ 0 ] . minPressure , 850 , 'hodograph.segments[0].minPressure' ) ;
337
+ assert . equal ( s . options . hodograph . segments [ 0 ] . maxPressure , 1000 , 'hodograph.segments[0].maxPressure' ) ;
338
+ assert . equal ( s . options . hodograph . segments [ 0 ] . visible , true , 'hodograph.segments[0].visible' ) ;
339
+ assert . equal ( Object . keys ( s . options . hodograph . segments [ 0 ] . style ) . length , 2 , 'keys hodograph.segments[0].style' ) ;
340
+ assert . equal ( s . options . hodograph . segments [ 0 ] . style . color , 'violet' , 'hodograph.segments[0].style.color' ) ;
341
+ assert . equal ( s . options . hodograph . segments [ 0 ] . style . width , 1 , 'hodograph.segments[0].style.width' ) ;
261
342
} ) ;
262
343
it ( 'getParcelOptions()' , ( ) => {
263
344
const sounding = new Sounding ( ) ;
0 commit comments