@@ -768,8 +768,15 @@ describe('end-to-end scatter tests', function() {
768
768
} ) ;
769
769
770
770
it ( 'should work with typed arrays' , function ( done ) {
771
- var colors = [ 'rgb(255, 0, 0)' , 'rgb(0, 0, 255)' , 'rgb(0, 255, 0)' ] ;
772
- var sizes = [ 20 , 30 , 10 ] ;
771
+ function _assert ( colors , sizes ) {
772
+ var pts = d3 . selectAll ( '.point' ) ;
773
+ expect ( pts . size ( ) ) . toBe ( 3 , '# of pts' ) ;
774
+
775
+ pts . each ( function ( _ , i ) {
776
+ expect ( getColor ( this ) ) . toBe ( colors [ i ] , 'color ' + i ) ;
777
+ expect ( getMarkerSize ( this ) ) . toBe ( sizes [ i ] , 'size ' + i ) ;
778
+ } ) ;
779
+ }
773
780
774
781
Plotly . newPlot ( gd , [ {
775
782
x : new Float32Array ( [ 1 , 2 , 3 ] ) ,
@@ -787,14 +794,22 @@ describe('end-to-end scatter tests', function() {
787
794
}
788
795
} ] )
789
796
. then ( function ( ) {
790
- var pts = d3 . selectAll ( '.point' ) ;
791
- expect ( pts . size ( ) ) . toBe ( 3 , '# of pts' ) ;
797
+ _assert (
798
+ [ 'rgb(255, 0, 0)' , 'rgb(0, 0, 255)' , 'rgb(0, 255, 0)' ] ,
799
+ [ 20 , 30 , 10 ]
800
+ ) ;
792
801
793
- pts . each ( function ( _ , i ) {
794
- expect ( getColor ( this ) ) . toBe ( colors [ i ] , 'color ' + i ) ;
795
- expect ( getMarkerSize ( this ) ) . toBe ( sizes [ i ] , 'size ' + i ) ;
802
+ return Plotly . restyle ( gd , {
803
+ 'marker.size' : [ new Float32Array ( [ 40 , 30 , 20 ] ) ] ,
804
+ 'marker.color' : [ new Float32Array ( [ 20 , 30 , 10 ] ) ]
796
805
} ) ;
797
806
} )
807
+ . then ( function ( ) {
808
+ _assert (
809
+ [ 'rgb(0, 255, 0)' , 'rgb(0, 0, 255)' , 'rgb(255, 0, 0)' ] ,
810
+ [ 40 , 30 , 20 ]
811
+ ) ;
812
+ } )
798
813
. catch ( fail )
799
814
. then ( done ) ;
800
815
} ) ;
0 commit comments