@@ -546,11 +546,30 @@ describe('attaching component bindings', function() {
546
546
// Check that it has attached a listener:
547
547
expect ( typeof gd . _internalEv . _events . plotly_animatingframe ) . toBe ( 'function' ) ;
548
548
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' } ) ;
550
565
} ) . then ( function ( ) {
566
+ // Confirm that the lookup table has been updated:
567
+ expect ( gd . layout . sliders [ 0 ] . active ) . toBe ( 0 ) ;
568
+
551
569
// Check that it still has one attached listener:
552
570
expect ( typeof gd . _internalEv . _events . plotly_animatingframe ) . toBe ( 'function' ) ;
553
571
572
+ // Change this to a non-simple binding:
554
573
return Plotly . relayout ( gd , { 'sliders[0].steps[0].args[0]' : 'line.color' } ) ;
555
574
} ) . then ( function ( ) {
556
575
// Bindings are no longer simple, so check to ensure they have
0 commit comments