@@ -25,7 +25,7 @@ describe('css injection', function() {
25
25
26
26
// the most basic of basic plots
27
27
function plot ( target ) {
28
- return Plotly . plot ( target , [ {
28
+ Plotly . plot ( target , [ {
29
29
x : [ 1 , 2 , 3 , 4 , 5 ] ,
30
30
y : [ 1 , 2 , 4 , 8 , 16 ]
31
31
} ] , {
@@ -60,7 +60,7 @@ describe('css injection', function() {
60
60
}
61
61
}
62
62
63
- it ( 'inserts styles on initial plot' , function ( done ) {
63
+ it ( 'inserts styles on initial plot' , function ( ) {
64
64
deletePlotCSSRules ( document ) ; // clear the rules
65
65
66
66
// fix scope errors
@@ -78,44 +78,42 @@ describe('css injection', function() {
78
78
79
79
// plot
80
80
var gd = createGraphDiv ( ) ;
81
- plot ( gd ) . then ( function ( ) {
81
+ plot ( gd ) ;
82
82
83
- // check for styles
84
- allSelectors = plotcss_utils . getAllRuleSelectors ( document ) ;
83
+ // check for styles
84
+ allSelectors = plotcss_utils . getAllRuleSelectors ( document ) ;
85
85
86
- for ( selector in plotcss ) {
87
- fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
86
+ for ( selector in plotcss ) {
87
+ fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
88
88
89
- expect ( allSelectors . indexOf ( fullSelector ) ) . not . toEqual ( - 1 ) ;
90
- }
89
+ expect ( allSelectors . indexOf ( fullSelector ) ) . not . toEqual ( - 1 ) ;
90
+ }
91
91
92
- // clean up
93
- return destroyGraphDiv ( ) ;
94
- } ) . then ( done ) ;
92
+ // clean up
93
+ destroyGraphDiv ( ) ;
95
94
} ) ;
96
95
97
- it ( 'inserts styles in a child window document' , function ( done ) {
96
+ it ( 'inserts styles in a child window document' , function ( ) {
98
97
var gd = createGraphDivInChildWindow ( ) ;
99
98
var childWindow = gd . ownerDocument . defaultView ;
100
99
101
100
// plot
102
- plot ( gd ) . then ( function ( ) {
101
+ plot ( gd ) ;
103
102
104
- // check for styles
105
- var allSelectors = plotcss_utils . getAllRuleSelectors ( gd . ownerDocument ) ;
103
+ // check for styles
104
+ var allSelectors = plotcss_utils . getAllRuleSelectors ( gd . ownerDocument ) ;
106
105
107
- for ( var selector in plotcss ) {
108
- var fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
106
+ for ( var selector in plotcss ) {
107
+ var fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
109
108
110
- expect ( allSelectors . indexOf ( fullSelector ) ) . not . toEqual ( - 1 ) ;
111
- }
109
+ expect ( allSelectors . indexOf ( fullSelector ) ) . not . toEqual ( - 1 ) ;
110
+ }
112
111
113
- // clean up
114
- childWindow . close ( ) ;
115
- } ) . then ( done ) ;
112
+ // clean up
113
+ childWindow . close ( ) ;
116
114
} ) ;
117
115
118
- it ( 'does not insert duplicate styles' , function ( done ) {
116
+ it ( 'does not insert duplicate styles' , function ( ) {
119
117
deletePlotCSSRules ( document ) ; // clear the rules
120
118
121
119
// fix scope errors
@@ -133,23 +131,22 @@ describe('css injection', function() {
133
131
134
132
// plot
135
133
var gd = createGraphDiv ( ) ;
136
- plot ( gd ) . then ( function ( ) {
137
- return plot ( gd ) ; // plot again so injectStyles gets called again
138
- } ) . then ( function ( ) {
139
- // check for styles
140
- allSelectors = plotcss_utils . getAllRuleSelectors ( document ) ;
134
+ plot ( gd ) ;
135
+ plot ( gd ) ; // plot again so injectStyles gets called again
136
+
137
+ // check for styles
138
+ allSelectors = plotcss_utils . getAllRuleSelectors ( document ) ;
141
139
142
- for ( selector in plotcss ) {
143
- fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
140
+ for ( selector in plotcss ) {
141
+ fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
144
142
145
- var firstIndex = allSelectors . indexOf ( fullSelector ) ;
143
+ var firstIndex = allSelectors . indexOf ( fullSelector ) ;
146
144
147
- // there should be no occurences after the initial one
148
- expect ( allSelectors . indexOf ( fullSelector , firstIndex + 1 ) ) . toEqual ( - 1 ) ;
149
- }
145
+ // there should be no occurences after the initial one
146
+ expect ( allSelectors . indexOf ( fullSelector , firstIndex + 1 ) ) . toEqual ( - 1 ) ;
147
+ }
150
148
151
- // clean up
152
- return destroyGraphDiv ( ) ;
153
- } ) . then ( done ) ;
149
+ // clean up
150
+ destroyGraphDiv ( ) ;
154
151
} ) ;
155
152
} ) ;
0 commit comments