Skip to content

Commit 0d3da5e

Browse files
committed
Change namespace of transition
1 parent db6b942 commit 0d3da5e

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

test/jasmine/tests/animate_test.js

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var Plotly = require('@lib/index');
2-
var PlotlyInternal = require('@src/plotly');
32
var Lib = require('@src/lib');
3+
var Plots = Plotly.Plots;
44

55
var createGraphDiv = require('../assets/create_graph_div');
66
var destroyGraphDiv = require('../assets/destroy_graph_div');
@@ -19,7 +19,7 @@ describe('Test animate API', function() {
1919
}
2020

2121
function verifyFrameTransitionOrder(gd, expectedFrames) {
22-
var calls = PlotlyInternal.transition.calls;
22+
var calls = Plots.transition.calls;
2323

2424
expect(calls.count()).toEqual(expectedFrames.length);
2525

@@ -35,7 +35,7 @@ describe('Test animate API', function() {
3535

3636
mockCopy = Lib.extendDeep({}, mock);
3737

38-
spyOn(PlotlyInternal, 'transition').and.callFake(function() {
38+
spyOn(Plots, 'transition').and.callFake(function() {
3939
// Transition's fake behaviro is to resolve after a short period of time:
4040
return Promise.resolve().then(delay(5));
4141
});
@@ -61,9 +61,9 @@ describe('Test animate API', function() {
6161

6262
it('animates to a frame', function(done) {
6363
Plotly.animate(gd, ['frame0'], {transitionduration: 1.2345}).then(function() {
64-
expect(PlotlyInternal.transition).toHaveBeenCalled();
64+
expect(Plots.transition).toHaveBeenCalled();
6565

66-
var args = PlotlyInternal.transition.calls.mostRecent().args;
66+
var args = Plots.transition.calls.mostRecent().args;
6767

6868
// was called with gd, data, layout, traceIndices, transitionConfig:
6969
expect(args.length).toEqual(5);
@@ -92,7 +92,7 @@ describe('Test animate API', function() {
9292
it('treats objects as frames', function(done) {
9393
var frame = {data: [{x: [1, 2, 3]}]};
9494
Plotly.animate(gd, frame, transOpts).then(function() {
95-
expect(PlotlyInternal.transition.calls.count()).toEqual(1);
95+
expect(Plots.transition.calls.count()).toEqual(1);
9696
verifyQueueEmpty(gd);
9797
}).catch(fail).then(done);
9898
});
@@ -101,15 +101,15 @@ describe('Test animate API', function() {
101101
var frame1 = {data: [{x: [1, 2, 3]}], traces: [0], layout: {foo: 'bar'}};
102102
var frame2 = {data: [{x: [3, 4, 5]}], traces: [1], layout: {foo: 'baz'}};
103103
Plotly.animate(gd, [frame1, frame2], transOpts).then(function() {
104-
expect(PlotlyInternal.transition.calls.argsFor(0)[1]).toEqual(frame1.data);
105-
expect(PlotlyInternal.transition.calls.argsFor(0)[2]).toEqual(frame1.layout);
106-
expect(PlotlyInternal.transition.calls.argsFor(0)[3]).toEqual(frame1.traces);
104+
expect(Plots.transition.calls.argsFor(0)[1]).toEqual(frame1.data);
105+
expect(Plots.transition.calls.argsFor(0)[2]).toEqual(frame1.layout);
106+
expect(Plots.transition.calls.argsFor(0)[3]).toEqual(frame1.traces);
107107

108-
expect(PlotlyInternal.transition.calls.argsFor(1)[1]).toEqual(frame2.data);
109-
expect(PlotlyInternal.transition.calls.argsFor(1)[2]).toEqual(frame2.layout);
110-
expect(PlotlyInternal.transition.calls.argsFor(1)[3]).toEqual(frame2.traces);
108+
expect(Plots.transition.calls.argsFor(1)[1]).toEqual(frame2.data);
109+
expect(Plots.transition.calls.argsFor(1)[2]).toEqual(frame2.layout);
110+
expect(Plots.transition.calls.argsFor(1)[3]).toEqual(frame2.traces);
111111

112-
expect(PlotlyInternal.transition.calls.count()).toEqual(2);
112+
expect(Plots.transition.calls.count()).toEqual(2);
113113
verifyQueueEmpty(gd);
114114
}).catch(fail).then(done);
115115
});
@@ -130,28 +130,28 @@ describe('Test animate API', function() {
130130

131131
it('animates to a single frame', function(done) {
132132
Plotly.animate(gd, ['frame0'], transOpts).then(function() {
133-
expect(PlotlyInternal.transition.calls.count()).toEqual(1);
133+
expect(Plots.transition.calls.count()).toEqual(1);
134134
verifyQueueEmpty(gd);
135135
}).catch(fail).then(done);
136136
});
137137

138138
it('animates to an empty list', function(done) {
139139
Plotly.animate(gd, [], transOpts).then(function() {
140-
expect(PlotlyInternal.transition.calls.count()).toEqual(0);
140+
expect(Plots.transition.calls.count()).toEqual(0);
141141
verifyQueueEmpty(gd);
142142
}).catch(fail).then(done);
143143
});
144144

145145
it('animates to a list of frames', function(done) {
146146
Plotly.animate(gd, ['frame0', 'frame1'], transOpts).then(function() {
147-
expect(PlotlyInternal.transition.calls.count()).toEqual(2);
147+
expect(Plots.transition.calls.count()).toEqual(2);
148148
verifyQueueEmpty(gd);
149149
}).catch(fail).then(done);
150150
});
151151

152152
it('animates frames by group', function(done) {
153153
Plotly.animate(gd, 'even-frames', transOpts).then(function() {
154-
expect(PlotlyInternal.transition.calls.count()).toEqual(2);
154+
expect(Plots.transition.calls.count()).toEqual(2);
155155
verifyQueueEmpty(gd);
156156
}).catch(fail).then(done);
157157
});
@@ -165,23 +165,23 @@ describe('Test animate API', function() {
165165

166166
it('accepts a single transitionOpts', function(done) {
167167
Plotly.animate(gd, ['frame0', 'frame1'], {transitionduration: 1.12345}).then(function() {
168-
var calls = PlotlyInternal.transition.calls;
168+
var calls = Plots.transition.calls;
169169
expect(calls.argsFor(0)[4].transitionduration).toEqual(1.12345);
170170
expect(calls.argsFor(1)[4].transitionduration).toEqual(1.12345);
171171
}).catch(fail).then(done);
172172
});
173173

174174
it('accepts an array of transitionOpts', function(done) {
175175
Plotly.animate(gd, ['frame0', 'frame1'], [{transitionduration: 1.123}, {transitionduration: 1.456}]).then(function() {
176-
var calls = PlotlyInternal.transition.calls;
176+
var calls = Plots.transition.calls;
177177
expect(calls.argsFor(0)[4].transitionduration).toEqual(1.123);
178178
expect(calls.argsFor(1)[4].transitionduration).toEqual(1.456);
179179
}).catch(fail).then(done);
180180
});
181181

182182
it('falls back to transitionOpts[0] if not enough supplied in array', function(done) {
183183
Plotly.animate(gd, ['frame0', 'frame1'], [{transitionduration: 1.123}]).then(function() {
184-
var calls = PlotlyInternal.transition.calls;
184+
var calls = Plots.transition.calls;
185185
expect(calls.argsFor(0)[4].transitionduration).toEqual(1.123);
186186
expect(calls.argsFor(1)[4].transitionduration).toEqual(1.123);
187187
}).catch(fail).then(done);
@@ -273,7 +273,7 @@ describe('Test animate API', function() {
273273
starts++;
274274
}).on('plotly_animated', function() {
275275
ends++;
276-
expect(PlotlyInternal.transition.calls.count()).toEqual(4);
276+
expect(Plots.transition.calls.count()).toEqual(4);
277277
expect(starts).toEqual(1);
278278
});
279279

@@ -287,7 +287,7 @@ describe('Test animate API', function() {
287287
it('an empty list with immediate dumps previous frames', function(done) {
288288
Plotly.animate(gd, ['frame0', 'frame1'], {frameduration: 50});
289289
Plotly.animate(gd, [], null, {immediate: true}).then(function() {
290-
expect(PlotlyInternal.transition.calls.count()).toEqual(1);
290+
expect(Plots.transition.calls.count()).toEqual(1);
291291
verifyQueueEmpty(gd);
292292
}).catch(fail).then(done);
293293
});
@@ -343,7 +343,7 @@ describe('Test animate API', function() {
343343
Plotly.animate(gd, ['frame0', 'frame1'], {transitionduration: 200, frameduration: 20}).then(function() {
344344
expect(starts).toEqual(1);
345345
expect(ends).toEqual(1);
346-
expect(PlotlyInternal.transition.calls.count()).toEqual(2);
346+
expect(Plots.transition.calls.count()).toEqual(2);
347347
verifyQueueEmpty(gd);
348348
}).catch(fail).then(done);
349349
});

test/jasmine/tests/transition_test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Plots.supplyTransitionDefaults', function() {
3838
});
3939

4040
function runTests(transitionDuration) {
41-
describe('Plotly.transition (duration = ' + transitionDuration + ')', function() {
41+
describe('Plots.transition (duration = ' + transitionDuration + ')', function() {
4242
'use strict';
4343

4444
var gd;
@@ -59,7 +59,7 @@ function runTests(transitionDuration) {
5959
it('resolves only once the transition has completed', function(done) {
6060
var t1 = Date.now();
6161

62-
Plotly.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, null, {transitionduration: transitionDuration})
62+
Plots.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, null, {transitionduration: transitionDuration})
6363
.then(delay(20))
6464
.then(function() {
6565
expect(Date.now() - t1).toBeGreaterThan(transitionDuration);
@@ -70,7 +70,7 @@ function runTests(transitionDuration) {
7070
var beginTransitionCnt = 0;
7171
gd.on('plotly_transitioning', function() { beginTransitionCnt++; });
7272

73-
Plotly.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, null, {transitionduration: transitionDuration})
73+
Plots.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, null, {transitionduration: transitionDuration})
7474
.then(delay(20))
7575
.then(function() {
7676
expect(beginTransitionCnt).toBe(1);
@@ -81,7 +81,7 @@ function runTests(transitionDuration) {
8181
var trEndCnt = 0;
8282
gd.on('plotly_transitioned', function() { trEndCnt++; });
8383

84-
Plotly.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, null, {transitionduration: transitionDuration})
84+
Plots.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, null, {transitionduration: transitionDuration})
8585
.then(delay(20))
8686
.then(function() {
8787
expect(trEndCnt).toEqual(1);
@@ -99,7 +99,7 @@ function runTests(transitionDuration) {
9999
gd.on('plotly_transitioned', function() { currentlyRunning--; endCnt++; });
100100

101101
function doTransition() {
102-
return Plotly.transition(gd, [{x: [1, 2]}], null, null, {transitionduration: transitionDuration});
102+
return Plots.transition(gd, [{x: [1, 2]}], null, null, {transitionduration: transitionDuration});
103103
}
104104

105105
function checkNoneRunning() {

0 commit comments

Comments
 (0)