@@ -4,18 +4,13 @@ var Plotly = require('@lib/index');
4
4
5
5
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
6
6
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
7
- var customMatchers = require ( '../assets/custom_matchers' ) ;
8
7
var failTest = require ( '../assets/fail_test' ) ;
9
8
10
9
describe ( 'Pies' , function ( ) {
11
10
'use strict' ;
12
11
13
12
var gd ;
14
13
15
- beforeAll ( function ( ) {
16
- jasmine . addMatchers ( customMatchers ) ;
17
- } ) ;
18
-
19
14
beforeEach ( function ( ) { gd = createGraphDiv ( ) ; } ) ;
20
15
21
16
afterEach ( destroyGraphDiv ) ;
@@ -37,19 +32,20 @@ describe('Pies', function() {
37
32
}
38
33
} ] , { height : 300 , width : 400 } ) . then ( function ( ) {
39
34
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)'
45
40
] ;
46
41
var opacities = [ 0.2 , 0.3 , 0.4 , 0.5 , 0.6 ] ;
47
42
48
43
function checkPath ( d , i ) {
49
44
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 ] ) ;
51
47
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)' ) ;
53
49
expect ( path . style ( 'stroke-opacity' ) ) . toBe ( '0.7' ) ;
54
50
}
55
51
var slices = d3 . selectAll ( '.slice path' ) ;
0 commit comments