Skip to content

Commit 78140c9

Browse files
authored
Merge pull request #5423 from plotly/drop-Plotly.Queue
Drop Plotly.Queue from the API
2 parents 9b30fea + 0cac2f5 commit 78140c9

File tree

3 files changed

+22
-30
lines changed

3 files changed

+22
-30
lines changed

src/core.js

-1
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,3 @@ exports.Fx = {
9090
};
9191
exports.Snapshot = require('./snapshot');
9292
exports.PlotSchema = require('./plot_api/plot_schema');
93-
exports.Queue = require('./lib/queue');

test/jasmine/tests/frame_api_test.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var Plotly = require('@lib/index');
22
var Lib = require('@src/lib');
3+
var Queue = require('@src/lib/queue');
34

45
var createGraphDiv = require('../assets/create_graph_div');
56
var destroyGraphDiv = require('../assets/destroy_graph_div');
@@ -181,7 +182,7 @@ describe('Test frame api', function() {
181182
expect(f[7]).toEqual({name: 'frame7', data: [2]});
182183
expect(f[10]).toEqual({name: 'frame10', data: [3]});
183184

184-
return Plotly.Queue.undo(gd);
185+
return Queue.undo(gd);
185186
})
186187
.then(validate)
187188
.then(done, done.fail);
@@ -207,7 +208,7 @@ describe('Test frame api', function() {
207208
expect(f[7]).toEqual({name: 'frame7', data: [2]});
208209
expect(f[10]).toEqual({name: 'frame10', data: [3]});
209210

210-
return Plotly.Queue.undo(gd);
211+
return Queue.undo(gd);
211212
})
212213
.then(validate)
213214
.then(done, done.fail);
@@ -220,12 +221,12 @@ describe('Test frame api', function() {
220221
}
221222

222223
Plotly.addFrames(gd, [{name: 'frame 0'}, {name: 'frame 1'}]).then(validate).then(function() {
223-
return Plotly.Queue.undo(gd);
224+
return Queue.undo(gd);
224225
}).then(function() {
225226
expect(f).toEqual([]);
226227
expect(h).toEqual({});
227228

228-
return Plotly.Queue.redo(gd);
229+
return Queue.redo(gd);
229230
})
230231
.then(validate)
231232
.then(done, done.fail);
@@ -242,12 +243,12 @@ describe('Test frame api', function() {
242243
expect(f).toEqual([{name: 'test1'}, {name: 'test2'}, {name: 'test3'}]);
243244
expect(Object.keys(h)).toEqual(['test1', 'test2', 'test3']);
244245

245-
return Plotly.Queue.undo(gd);
246+
return Queue.undo(gd);
246247
}).then(function() {
247248
expect(f).toEqual([{name: 'test1', data: ['y']}, {name: 'test2'}]);
248249
expect(Object.keys(h)).toEqual(['test1', 'test2']);
249250

250-
return Plotly.Queue.redo(gd);
251+
return Queue.redo(gd);
251252
}).then(function() {
252253
expect(f).toEqual([{name: 'test1'}, {name: 'test2'}, {name: 'test3'}]);
253254
expect(Object.keys(h)).toEqual(['test1', 'test2', 'test3']);
@@ -267,11 +268,11 @@ describe('Test frame api', function() {
267268
expect(f).toEqual([]);
268269
expect(Object.keys(h)).toEqual([]);
269270

270-
return Plotly.Queue.undo(gd);
271+
return Queue.undo(gd);
271272
}).then(function() {
272273
expect(f).toEqual([{name: 'frame1'}]);
273274

274-
return Plotly.Queue.redo(gd);
275+
return Queue.redo(gd);
275276
}).then(function() {
276277
expect(f).toEqual([]);
277278
expect(Object.keys(h)).toEqual([]);
@@ -297,13 +298,13 @@ describe('Test frame api', function() {
297298
Plotly.addFrames(gd, frames).then(function() {
298299
return Plotly.deleteFrames(gd, [2, 8, 4, 6]);
299300
}).then(validate).then(function() {
300-
return Plotly.Queue.undo(gd);
301+
return Queue.undo(gd);
301302
}).then(function() {
302303
for(i = 0; i < 10; i++) {
303304
expect(f[i]).toEqual({name: 'frame' + i});
304305
}
305306

306-
return Plotly.Queue.redo(gd);
307+
return Queue.redo(gd);
307308
})
308309
.then(validate)
309310
.then(done, done.fail);
@@ -328,13 +329,13 @@ describe('Test frame api', function() {
328329
return Plotly.deleteFrames(gd);
329330
}).then(validateCount(0)).then(function() {
330331
// Restore:
331-
return Plotly.Queue.undo(gd);
332+
return Queue.undo(gd);
332333
}).then(validateCount(n)).then(function() {
333334
// Delete with null arg:
334335
return Plotly.deleteFrames(gd, null);
335336
}).then(validateCount(0)).then(function() {
336337
// Restore:
337-
return Plotly.Queue.undo(gd);
338+
return Queue.undo(gd);
338339
}).then(validateCount(n)).then(function() {
339340
// Delete with undefined:
340341
return Plotly.deleteFrames(gd, undefined);

test/jasmine/tests/plot_api_test.js

+9-17
Original file line numberDiff line numberDiff line change
@@ -1898,16 +1898,8 @@ describe('Test plot api', function() {
18981898
]
18991899
};
19001900

1901-
if(!Plotly.Queue) {
1902-
Plotly.Queue = {
1903-
add: function() {},
1904-
startSequence: function() {},
1905-
endSequence: function() {}
1906-
};
1907-
}
1908-
19091901
spyOn(plotApi, 'redraw');
1910-
spyOn(Plotly.Queue, 'add');
1902+
spyOn(Queue, 'add');
19111903
});
19121904

19131905
it('should throw an error when gd.data isn\'t an array.', function() {
@@ -2054,9 +2046,9 @@ describe('Test plot api', function() {
20542046
}, [0, 1]);
20552047

20562048
expect(gd.data).not.toEqual(cachedData);
2057-
expect(Plotly.Queue.add).toHaveBeenCalled();
2049+
expect(Queue.add).toHaveBeenCalled();
20582050

2059-
var undoArgs = Plotly.Queue.add.calls.first().args[2];
2051+
var undoArgs = Queue.add.calls.first().args[2];
20602052

20612053
Plotly.prependTraces.apply(null, undoArgs);
20622054

@@ -2071,9 +2063,9 @@ describe('Test plot api', function() {
20712063
}, [0, 1]);
20722064

20732065
expect(gd.data).not.toEqual(cachedData);
2074-
expect(Plotly.Queue.add).toHaveBeenCalled();
2066+
expect(Queue.add).toHaveBeenCalled();
20752067

2076-
var undoArgs = Plotly.Queue.add.calls.first().args[2];
2068+
var undoArgs = Queue.add.calls.first().args[2];
20772069

20782070
Plotly.extendTraces.apply(null, undoArgs);
20792071

@@ -2089,9 +2081,9 @@ describe('Test plot api', function() {
20892081
}, [0, 1], maxPoints);
20902082

20912083
expect(gd.data).not.toEqual(cachedData);
2092-
expect(Plotly.Queue.add).toHaveBeenCalled();
2084+
expect(Queue.add).toHaveBeenCalled();
20932085

2094-
var undoArgs = Plotly.Queue.add.calls.first().args[2];
2086+
var undoArgs = Queue.add.calls.first().args[2];
20952087

20962088
Plotly.prependTraces.apply(null, undoArgs);
20972089

@@ -2148,12 +2140,12 @@ describe('Test plot api', function() {
21482140
}, [0, 1], args.maxp);
21492141

21502142
expect(plotApi.redraw).toHaveBeenCalled();
2151-
expect(Plotly.Queue.add).toHaveBeenCalled();
2143+
expect(Queue.add).toHaveBeenCalled();
21522144

21532145
expect(gd.data[0].x).toEqual(expectations.newArray);
21542146
expect(gd.data[1].x).toEqual(new Float32Array(expectations.newArray));
21552147

2156-
var cont = Plotly.Queue.add.calls.first().args[2][1].x;
2148+
var cont = Queue.add.calls.first().args[2][1].x;
21572149
expect(cont[0]).toEqual(expectations.remainder);
21582150
expect(cont[1]).toEqual(new Float32Array(expectations.remainder));
21592151
}

0 commit comments

Comments
 (0)