@@ -768,8 +768,15 @@ describe('end-to-end scatter tests', function() {
768768 } ) ;
769769
770770 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+ }
773780
774781 Plotly . newPlot ( gd , [ {
775782 x : new Float32Array ( [ 1 , 2 , 3 ] ) ,
@@ -787,14 +794,22 @@ describe('end-to-end scatter tests', function() {
787794 }
788795 } ] )
789796 . 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+ ) ;
792801
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 ] ) ]
796805 } ) ;
797806 } )
807+ . then ( function ( ) {
808+ _assert (
809+ [ 'rgb(0, 255, 0)' , 'rgb(0, 0, 255)' , 'rgb(255, 0, 0)' ] ,
810+ [ 40 , 30 , 20 ]
811+ ) ;
812+ } )
798813 . catch ( fail )
799814 . then ( done ) ;
800815 } ) ;
0 commit comments