1
1
var Plotly = require ( '@lib/index' ) ;
2
- var PlotlyInternal = require ( '@src/plotly ' ) ;
2
+ var Registry = require ( '@src/registry ' ) ;
3
3
var Plots = Plotly . Plots ;
4
4
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
5
5
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
@@ -21,14 +21,14 @@ describe('Plots.executeAPICommand', function() {
21
21
22
22
describe ( 'with a successful API command' , function ( ) {
23
23
beforeEach ( function ( ) {
24
- spyOn ( PlotlyInternal , 'restyle' ) . and . callFake ( function ( ) {
24
+ spyOn ( Registry . apiMethodRegistry , 'restyle' ) . and . callFake ( function ( ) {
25
25
return Promise . resolve ( 'resolution' ) ;
26
26
} ) ;
27
27
} ) ;
28
28
29
29
it ( 'calls the API method and resolves' , function ( done ) {
30
30
Plots . executeAPICommand ( gd , 'restyle' , [ 'foo' , 'bar' ] ) . then ( function ( value ) {
31
- var m = PlotlyInternal . restyle ;
31
+ var m = Registry . apiMethodRegistry . restyle ;
32
32
expect ( m ) . toHaveBeenCalled ( ) ;
33
33
expect ( m . calls . count ( ) ) . toEqual ( 1 ) ;
34
34
expect ( m . calls . argsFor ( 0 ) ) . toEqual ( [ gd , 'foo' , 'bar' ] ) ;
@@ -41,14 +41,14 @@ describe('Plots.executeAPICommand', function() {
41
41
42
42
describe ( 'with an unsuccessful command' , function ( ) {
43
43
beforeEach ( function ( ) {
44
- spyOn ( PlotlyInternal , 'restyle' ) . and . callFake ( function ( ) {
44
+ spyOn ( Registry . apiMethodRegistry , 'restyle' ) . and . callFake ( function ( ) {
45
45
return Promise . reject ( 'rejection' ) ;
46
46
} ) ;
47
47
} ) ;
48
48
49
49
it ( 'calls the API method and rejects' , function ( done ) {
50
50
Plots . executeAPICommand ( gd , 'restyle' , [ 'foo' , 'bar' ] ) . then ( fail , function ( value ) {
51
- var m = PlotlyInternal . restyle ;
51
+ var m = Registry . apiMethodRegistry . restyle ;
52
52
expect ( m ) . toHaveBeenCalled ( ) ;
53
53
expect ( m . calls . count ( ) ) . toEqual ( 1 ) ;
54
54
expect ( m . calls . argsFor ( 0 ) ) . toEqual ( [ gd , 'foo' , 'bar' ] ) ;
0 commit comments