@@ -4,18 +4,13 @@ var Plotly = require('@lib/index');
44
55var createGraphDiv = require ( '../assets/create_graph_div' ) ;
66var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
7- var customMatchers = require ( '../assets/custom_matchers' ) ;
87var failTest = require ( '../assets/fail_test' ) ;
98
109describe ( 'Pies' , function ( ) {
1110 'use strict' ;
1211
1312 var gd ;
1413
15- beforeAll ( function ( ) {
16- jasmine . addMatchers ( customMatchers ) ;
17- } ) ;
18-
1914 beforeEach ( function ( ) { gd = createGraphDiv ( ) ; } ) ;
2015
2116 afterEach ( destroyGraphDiv ) ;
@@ -37,19 +32,20 @@ describe('Pies', function() {
3732 }
3833 } ] , { height : 300 , width : 400 } ) . then ( function ( ) {
3934 var colors = [
40- 'rgb(0, 0, 0)' ,
41- 'rgb(255, 0, 0)' ,
42- 'rgb(0, 255, 0)' ,
43- 'rgb(0, 0, 255)' ,
44- 'rgb(255, 255, 0)'
35+ 'rgb(0,0, 0)' ,
36+ 'rgb(255,0, 0)' ,
37+ 'rgb(0,255,0)' ,
38+ 'rgb(0,0, 255)' ,
39+ 'rgb(255,255,0)'
4540 ] ;
4641 var opacities = [ 0.2 , 0.3 , 0.4 , 0.5 , 0.6 ] ;
4742
4843 function checkPath ( d , i ) {
4944 var path = d3 . select ( this ) ;
50- expect ( path . style ( 'fill' ) ) . toBe ( colors [ i ] ) ;
45+ // strip spaces (ie 'rgb(0, 0, 0)') so we're not dependent on browser specifics
46+ expect ( path . style ( 'fill' ) . replace ( / \s / g, '' ) ) . toBe ( colors [ i ] ) ;
5147 expect ( path . style ( 'fill-opacity' ) ) . toBe ( String ( opacities [ i ] ) ) ;
52- expect ( path . style ( 'stroke' ) ) . toBe ( 'rgb(100, 100, 100)' ) ;
48+ expect ( path . style ( 'stroke' ) . replace ( / \s / g , '' ) ) . toBe ( 'rgb(100,100,100)' ) ;
5349 expect ( path . style ( 'stroke-opacity' ) ) . toBe ( '0.7' ) ;
5450 }
5551 var slices = d3 . selectAll ( '.slice path' ) ;
0 commit comments