Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f55e58d

Browse files
committed
Switch groupby tests to failing syntax
1 parent 2b24f9d commit f55e58d

File tree

1 file changed

+48
-18
lines changed

1 file changed

+48
-18
lines changed

test/jasmine/tests/transform_groupby_test.js

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ describe('groupby', function() {
1919
transforms: [{
2020
type: 'groupby',
2121
groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'],
22-
style: { a: {marker: {color: 'red'}}, b: {marker: {color: 'blue'}} }
22+
style: [
23+
{target: 'a', value: {marker: {color: 'red'}}},
24+
{target: 'b', value: {marker: {color: 'blue'}}}
25+
]
2326
}]
2427
}];
2528

@@ -30,7 +33,10 @@ describe('groupby', function() {
3033
transforms: [{
3134
type: 'groupby',
3235
groups: ['b', 'a', 'b', 'b', 'b', 'a', 'a'],
33-
style: { a: {marker: {color: 'green'}}, b: {marker: {color: 'black'}} }
36+
style: [
37+
{target: 'a', value: {marker: {color: 'green'}}},
38+
{target: 'b', value: {marker: {color: 'black'}}}
39+
]
3440
}]
3541
}];
3642

@@ -92,7 +98,10 @@ describe('groupby', function() {
9298
expect(gd._fullData[1].marker.opacity).toEqual(1);
9399

94100
return Plotly.restyle(gd, {
95-
'transforms[0].style': { a: {marker: {color: 'green'}}, b: {marker: {color: 'red'}} },
101+
'transforms[0].style': [
102+
{target: 'a', value: {marker: {color: 'green'}}},
103+
{target: 'b', value: {marker: {color: 'red'}}}
104+
],
96105
'marker.opacity': 0.4
97106
});
98107
}).then(function() {
@@ -192,7 +201,10 @@ describe('groupby', function() {
192201
transforms: [{
193202
type: 'groupby',
194203
groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'],
195-
style: { a: {marker: {color: 'red'}}, b: {marker: {color: 'blue'}} }
204+
style: [
205+
{target: 'a', value: {marker: {color: 'red'}}},
206+
{target: 'b', value: {marker: {color: 'blue'}}}
207+
]
196208
}]
197209
}];
198210

@@ -387,7 +399,10 @@ describe('groupby', function() {
387399
transforms: [{
388400
type: 'groupby',
389401
groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'],
390-
style: { a: {marker: {color: 'red'}}, b: {marker: {color: 'blue'}} }
402+
style: [
403+
{target: 'a', value: {marker: {color: 'red'}}},
404+
{taret: 'b', value: {marker: {color: 'blue'}}}
405+
]
391406
}]
392407
}];
393408

@@ -401,17 +416,20 @@ describe('groupby', function() {
401416
transforms: [{
402417
type: 'groupby',
403418
groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'],
404-
style: {
405-
a: {
419+
style: [{
420+
target: 'a',
421+
value: {
406422
marker: {
407423
color: 'orange',
408424
size: 20,
409425
line: {
410426
color: 'red'
411427
}
412428
}
413-
},
414-
b: {
429+
}
430+
}, {
431+
target: 'b',
432+
value: {
415433
mode: 'markers+lines', // heterogeonos attributes are OK: group 'a' doesn't need to define this
416434
marker: {
417435
color: 'cyan',
@@ -426,7 +444,7 @@ describe('groupby', function() {
426444
color: 'purple'
427445
}
428446
}
429-
}
447+
}]
430448
}]
431449
}];
432450

@@ -447,11 +465,14 @@ describe('groupby', function() {
447465
transforms: [{
448466
type: 'groupby',
449467
groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'],
450-
style: {
451-
a: {marker: {size: 30}},
468+
style: [{
469+
target: 'a',
470+
value: {marker: {size: 30}}
471+
}, {
452472
// override general color:
453-
b: {marker: {size: 15, line: {color: 'yellow'}}, line: {color: 'purple'}}
454-
}
473+
target: 'b',
474+
value: {marker: {size: 15, line: {color: 'yellow'}}, line: {color: 'purple'}}
475+
}]
455476
}]
456477
}];
457478

@@ -464,7 +485,7 @@ describe('groupby', function() {
464485
transforms: [{
465486
type: 'groupby',
466487
groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'],
467-
style: {/* can be empty, or of partial group id coverage */}
488+
style: [/* can be empty, or of partial group id coverage */]
468489
}]
469490
}];
470491

@@ -548,7 +569,10 @@ describe('groupby', function() {
548569
transforms: [{
549570
type: 'groupby',
550571
// groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'],
551-
style: { a: {marker: {color: 'red'}}, b: {marker: {color: 'blue'}} }
572+
style: [
573+
{target: 'a', value: {marker: {color: 'red'}}},
574+
{target: 'b', value: {marker: {color: 'blue'}}}
575+
]
552576
}]
553577
}];
554578

@@ -561,7 +585,10 @@ describe('groupby', function() {
561585
transforms: [{
562586
type: 'groupby',
563587
groups: [],
564-
style: { a: {marker: {color: 'red'}}, b: {marker: {color: 'blue'}} }
588+
style: [
589+
{target: 'a', value: {marker: {color: 'red'}}},
590+
{target: 'b', value: {marker: {color: 'blue'}}}
591+
]
565592
}]
566593
}];
567594

@@ -574,7 +601,10 @@ describe('groupby', function() {
574601
transforms: [{
575602
type: 'groupby',
576603
groups: null,
577-
style: { a: {marker: {color: 'red'}}, b: {marker: {color: 'blue'}} }
604+
style: [
605+
{target: 'a', value: {marker: {color: 'red'}}},
606+
{target: 'b', value: {marker: {color: 'blue'}}}
607+
]
578608
}]
579609
}];
580610

0 commit comments

Comments
 (0)