11var Plotly = require ( '@src/plotly' ) ;
2+ var Plots = require ( '@src/plots/plots' ) ;
23var createGraphDiv = require ( '../assets/create_graph_div' ) ;
34var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
45
56
6- describe ( 'Test Plotly.Plots' , function ( ) {
7+
8+ describe ( 'Test Plots' , function ( ) {
79 'use strict' ;
810
9- describe ( 'Plotly. Plots.supplyLayoutGlobalDefaults should' , function ( ) {
11+ describe ( 'Plots.supplyLayoutGlobalDefaults should' , function ( ) {
1012 var layoutIn ,
1113 layoutOut ,
1214 expected ;
1315
14- var supplyLayoutDefaults = Plotly . Plots . supplyLayoutGlobalDefaults ;
16+ var supplyLayoutDefaults = Plots . supplyLayoutGlobalDefaults ;
1517
1618 beforeEach ( function ( ) {
1719 layoutOut = { } ;
@@ -65,8 +67,8 @@ describe('Test Plotly.Plots', function() {
6567
6668 } ) ;
6769
68- describe ( 'Plotly. Plots.supplyDataDefaults' , function ( ) {
69- var supplyDataDefaults = Plotly . Plots . supplyDataDefaults ,
70+ describe ( 'Plots.supplyDataDefaults' , function ( ) {
71+ var supplyDataDefaults = Plots . supplyDataDefaults ,
7072 layout = { } ;
7173
7274 var traceIn , traceOut ;
@@ -98,8 +100,8 @@ describe('Test Plotly.Plots', function() {
98100 } ) ;
99101 } ) ;
100102
101- describe ( 'Plotly. Plots.getSubplotIds' , function ( ) {
102- var getSubplotIds = Plotly . Plots . getSubplotIds ;
103+ describe ( 'Plots.getSubplotIds' , function ( ) {
104+ var getSubplotIds = Plots . getSubplotIds ;
103105 var layout ;
104106
105107 it ( 'returns scene ids' , function ( ) {
@@ -143,8 +145,8 @@ describe('Test Plotly.Plots', function() {
143145 } ) ;
144146 } ) ;
145147
146- describe ( 'Plotly. Plots.getSubplotIdsInData' , function ( ) {
147- var getSubplotIdsInData = Plotly . Plots . getSubplotIdsInData ;
148+ describe ( 'Plots.getSubplotIdsInData' , function ( ) {
149+ var getSubplotIdsInData = Plots . getSubplotIdsInData ;
148150
149151 var ids , data ;
150152
@@ -173,11 +175,11 @@ describe('Test Plotly.Plots', function() {
173175
174176 } ) ;
175177
176- describe ( 'Plotly. Plots.register, getModule, and traceIs' , function ( ) {
178+ describe ( 'Plots.register, getModule, and traceIs' , function ( ) {
177179 beforeEach ( function ( ) {
178- this . modulesKeys = Object . keys ( Plotly . Plots . modules ) ;
179- this . allTypesKeys = Object . keys ( Plotly . Plots . allTypes ) ;
180- this . allCategoriesKeys = Object . keys ( Plotly . Plots . allCategories ) ;
180+ this . modulesKeys = Object . keys ( Plots . modules ) ;
181+ this . allTypesKeys = Object . keys ( Plots . allTypes ) ;
182+ this . allCategoriesKeys = Object . keys ( Plots . allCategories ) ;
181183
182184 this . fakeModule = {
183185 calc : function ( ) { return 42 ; } ,
@@ -187,7 +189,7 @@ describe('Test Plotly.Plots', function() {
187189 plot : function ( ) { throw new Error ( 'nope!' ) ; }
188190 } ;
189191
190- Plotly . Plots . register ( this . fakeModule , 'newtype' , [ 'red' , 'green' ] ) ;
192+ Plots . register ( this . fakeModule , 'newtype' , [ 'red' , 'green' ] ) ;
191193
192194 spyOn ( console , 'warn' ) ;
193195 } ) ;
@@ -199,52 +201,50 @@ describe('Test Plotly.Plots', function() {
199201 } ) ;
200202 }
201203
202- revertObj ( Plotly . Plots . modules , this . modulesKeys ) ;
203- revertObj ( Plotly . Plots . allTypes , this . allTypesKeys ) ;
204- revertObj ( Plotly . Plots . allCategories , this . allCategoriesKeys ) ;
204+ revertObj ( Plots . modules , this . modulesKeys ) ;
205+ revertObj ( Plots . allTypes , this . allTypesKeys ) ;
206+ revertObj ( Plots . allCategories , this . allCategoriesKeys ) ;
205207 } ) ;
206208
207- it ( 'should error on attempts to reregister a type' , function ( ) {
208- var fm2 = this . fakeModule2 ;
209- expect ( function ( ) { Plotly . Plots . register ( fm2 , 'newtype' , [ 'yellow' , 'blue' ] ) ; } )
210- . toThrow ( new Error ( 'type newtype already registered' ) ) ;
211- expect ( Plotly . Plots . allCategories . yellow ) . toBeUndefined ( ) ;
209+ it ( 'should warn on attempts to reregister a type' , function ( ) {
210+ Plots . register ( this . fakeModule2 , 'newtype' , [ 'yellow' , 'blue' ] ) ;
211+ expect ( Plots . allCategories . yellow ) . toBeUndefined ( ) ;
212212 } ) ;
213213
214214 it ( 'should find the module for a type' , function ( ) {
215- expect ( Plotly . Plots . getModule ( 'newtype' ) ) . toBe ( this . fakeModule ) ;
216- expect ( Plotly . Plots . getModule ( { type : 'newtype' } ) ) . toBe ( this . fakeModule ) ;
215+ expect ( Plots . getModule ( 'newtype' ) ) . toBe ( this . fakeModule ) ;
216+ expect ( Plots . getModule ( { type : 'newtype' } ) ) . toBe ( this . fakeModule ) ;
217217 } ) ;
218218
219219 it ( 'should return false for types it doesn\'t know' , function ( ) {
220- expect ( Plotly . Plots . getModule ( 'notatype' ) ) . toBe ( false ) ;
221- expect ( Plotly . Plots . getModule ( { type : 'notatype' } ) ) . toBe ( false ) ;
222- expect ( Plotly . Plots . getModule ( { type : 'newtype' , r : 'this is polar' } ) ) . toBe ( false ) ;
220+ expect ( Plots . getModule ( 'notatype' ) ) . toBe ( false ) ;
221+ expect ( Plots . getModule ( { type : 'notatype' } ) ) . toBe ( false ) ;
222+ expect ( Plots . getModule ( { type : 'newtype' , r : 'this is polar' } ) ) . toBe ( false ) ;
223223 } ) ;
224224
225225 it ( 'should find the categories for this type' , function ( ) {
226- expect ( Plotly . Plots . traceIs ( 'newtype' , 'red' ) ) . toBe ( true ) ;
227- expect ( Plotly . Plots . traceIs ( { type : 'newtype' } , 'red' ) ) . toBe ( true ) ;
226+ expect ( Plots . traceIs ( 'newtype' , 'red' ) ) . toBe ( true ) ;
227+ expect ( Plots . traceIs ( { type : 'newtype' } , 'red' ) ) . toBe ( true ) ;
228228 } ) ;
229229
230230 it ( 'should not find other real categories' , function ( ) {
231- expect ( Plotly . Plots . traceIs ( 'newtype' , 'cartesian' ) ) . toBe ( false ) ;
232- expect ( Plotly . Plots . traceIs ( { type : 'newtype' } , 'cartesian' ) ) . toBe ( false ) ;
231+ expect ( Plots . traceIs ( 'newtype' , 'cartesian' ) ) . toBe ( false ) ;
232+ expect ( Plots . traceIs ( { type : 'newtype' } , 'cartesian' ) ) . toBe ( false ) ;
233233 expect ( console . warn ) . not . toHaveBeenCalled ( ) ;
234234 } ) ;
235235 } ) ;
236236
237- describe ( 'Plotly. Plots.registerSubplot' , function ( ) {
237+ describe ( 'Plots.registerSubplot' , function ( ) {
238238 var fake = {
239239 name : 'fake' ,
240240 attr : 'abc' ,
241241 idRoot : 'cba' ,
242242 attributes : { stuff : { 'more stuff' : 102102 } }
243243 } ;
244244
245- Plotly . Plots . registerSubplot ( fake ) ;
245+ Plots . registerSubplot ( fake ) ;
246246
247- var subplotsRegistry = Plotly . Plots . subplotsRegistry ;
247+ var subplotsRegistry = Plots . subplotsRegistry ;
248248
249249 it ( 'should register attr, idRoot and attributes' , function ( ) {
250250 expect ( subplotsRegistry . fake . attr ) . toEqual ( 'abc' ) ;
@@ -307,7 +307,7 @@ describe('Test Plotly.Plots', function() {
307307
308308 } ) ;
309309
310- describe ( 'Plotly. Plots.purge' , function ( ) {
310+ describe ( 'Plots.purge' , function ( ) {
311311 var gd ;
312312
313313 beforeEach ( function ( done ) {
@@ -324,7 +324,7 @@ describe('Test Plotly.Plots', function() {
324324 '_hmpixcount' , '_hmlumcount'
325325 ] ;
326326
327- Plotly . Plots . purge ( gd ) ;
327+ Plots . purge ( gd ) ;
328328 expect ( Object . keys ( gd ) ) . toEqual ( expectedKeys ) ;
329329 expect ( gd . data ) . toBeUndefined ( ) ;
330330 expect ( gd . layout ) . toBeUndefined ( ) ;
0 commit comments