@@ -25,7 +25,7 @@ describe('css injection', function() {
2525
2626 // the most basic of basic plots
2727 function plot ( target ) {
28- return Plotly . plot ( target , [ {
28+ Plotly . plot ( target , [ {
2929 x : [ 1 , 2 , 3 , 4 , 5 ] ,
3030 y : [ 1 , 2 , 4 , 8 , 16 ]
3131 } ] , {
@@ -60,7 +60,7 @@ describe('css injection', function() {
6060 }
6161 }
6262
63- it ( 'inserts styles on initial plot' , function ( done ) {
63+ it ( 'inserts styles on initial plot' , function ( ) {
6464 deletePlotCSSRules ( document ) ; // clear the rules
6565
6666 // fix scope errors
@@ -78,44 +78,42 @@ describe('css injection', function() {
7878
7979 // plot
8080 var gd = createGraphDiv ( ) ;
81- plot ( gd ) . then ( function ( ) {
81+ plot ( gd ) ;
8282
83- // check for styles
84- allSelectors = plotcss_utils . getAllRuleSelectors ( document ) ;
83+ // check for styles
84+ allSelectors = plotcss_utils . getAllRuleSelectors ( document ) ;
8585
86- for ( selector in plotcss ) {
87- fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
86+ for ( selector in plotcss ) {
87+ fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
8888
89- expect ( allSelectors . indexOf ( fullSelector ) ) . not . toEqual ( - 1 ) ;
90- }
89+ expect ( allSelectors . indexOf ( fullSelector ) ) . not . toEqual ( - 1 ) ;
90+ }
9191
92- // clean up
93- return destroyGraphDiv ( ) ;
94- } ) . then ( done ) ;
92+ // clean up
93+ destroyGraphDiv ( ) ;
9594 } ) ;
9695
97- it ( 'inserts styles in a child window document' , function ( done ) {
96+ it ( 'inserts styles in a child window document' , function ( ) {
9897 var gd = createGraphDivInChildWindow ( ) ;
9998 var childWindow = gd . ownerDocument . defaultView ;
10099
101100 // plot
102- plot ( gd ) . then ( function ( ) {
101+ plot ( gd ) ;
103102
104- // check for styles
105- var allSelectors = plotcss_utils . getAllRuleSelectors ( gd . ownerDocument ) ;
103+ // check for styles
104+ var allSelectors = plotcss_utils . getAllRuleSelectors ( gd . ownerDocument ) ;
106105
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 ) ;
109108
110- expect ( allSelectors . indexOf ( fullSelector ) ) . not . toEqual ( - 1 ) ;
111- }
109+ expect ( allSelectors . indexOf ( fullSelector ) ) . not . toEqual ( - 1 ) ;
110+ }
112111
113- // clean up
114- childWindow . close ( ) ;
115- } ) . then ( done ) ;
112+ // clean up
113+ childWindow . close ( ) ;
116114 } ) ;
117115
118- it ( 'does not insert duplicate styles' , function ( done ) {
116+ it ( 'does not insert duplicate styles' , function ( ) {
119117 deletePlotCSSRules ( document ) ; // clear the rules
120118
121119 // fix scope errors
@@ -133,23 +131,22 @@ describe('css injection', function() {
133131
134132 // plot
135133 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 ) ;
141139
142- for ( selector in plotcss ) {
143- fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
140+ for ( selector in plotcss ) {
141+ fullSelector = plotcss_utils . buildFullSelector ( selector ) ;
144142
145- var firstIndex = allSelectors . indexOf ( fullSelector ) ;
143+ var firstIndex = allSelectors . indexOf ( fullSelector ) ;
146144
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+ }
150148
151- // clean up
152- return destroyGraphDiv ( ) ;
153- } ) . then ( done ) ;
149+ // clean up
150+ destroyGraphDiv ( ) ;
154151 } ) ;
155152} ) ;
0 commit comments