Skip to content

Commit 6abec15

Browse files
committed
Test more behavior of bindings
1 parent f8c0094 commit 6abec15

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test/jasmine/tests/command_test.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,30 @@ describe('attaching component bindings', function() {
546546
// Check that it has attached a listener:
547547
expect(typeof gd._internalEv._events.plotly_animatingframe).toBe('function');
548548

549-
return Plotly.relayout(gd, {'sliders[0].steps[0].args[1]': 'green'});
549+
// Confirm the first position is selected:
550+
expect(gd.layout.sliders[0].active).toBe(0);
551+
552+
// Modify the plot
553+
return Plotly.restyle(gd, {'marker.color': 'blue'});
554+
}).then(function () {
555+
// Confirm that this has changed the slider position:
556+
expect(gd.layout.sliders[0].active).toBe(1);
557+
558+
// Swap the values of the components:
559+
return Plotly.relayout(gd, {
560+
'sliders[0].steps[0].args[1]': 'green',
561+
'sliders[0].steps[1].args[1]': 'red'
562+
});
563+
}).then(function() {
564+
return Plotly.restyle(gd, {'marker.color': 'green'});
550565
}).then(function() {
566+
// Confirm that the lookup table has been updated:
567+
expect(gd.layout.sliders[0].active).toBe(0);
568+
551569
// Check that it still has one attached listener:
552570
expect(typeof gd._internalEv._events.plotly_animatingframe).toBe('function');
553571

572+
// Change this to a non-simple binding:
554573
return Plotly.relayout(gd, {'sliders[0].steps[0].args[0]': 'line.color'});
555574
}).then(function() {
556575
// Bindings are no longer simple, so check to ensure they have

0 commit comments

Comments
 (0)