Skip to content

Commit 6407795

Browse files
committed
fix the tests I must have only thought I had run successfully
1 parent 28a2e44 commit 6407795

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

test/jasmine/tests/contour_test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@ describe('contour calc', function() {
296296
contoursFinal.forEach(function(spec) {
297297
var out = _calc({
298298
z: [[0, 2], [3, 5]],
299-
contours: contoursIn,
299+
contours: Lib.extendFlat({}, contoursIn),
300300
ncontours: spec.inputNcontours
301301
}).trace;
302302

303303
['start', 'end', 'size'].forEach(function(attr) {
304-
expect(out.contours[attr]).toBe(spec[attr], [contoursIn, attr]);
304+
expect(out.contours[attr]).toBe(spec[attr], [contoursIn, spec.inputNcontours, attr]);
305305
// all these get copied back to the input trace
306-
expect(out._input.contours[attr]).toBe(spec[attr], [contoursIn, attr]);
306+
expect(out._input.contours[attr]).toBe(spec[attr], [contoursIn, spec.inputNcontours, attr]);
307307
});
308308

309309
expect(out._input.autocontour).toBe(true);

test/jasmine/tests/plot_api_test.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -282,29 +282,36 @@ describe('Test plot api', function() {
282282
expect(gd._fullData[0].marker.color).toBe(colorDflt[0]);
283283
expect(gd._fullData[1].marker.color).toBe(colorDflt[1]);
284284
});
285+
});
285286

286-
it('should redo auto z/contour when editing z array', function() {
287-
var gd = {
288-
data: [{type: 'contour', z: [[1, 2], [3, 4]]}]
289-
};
287+
describe('Plotly.restyle unmocked', function() {
288+
var gd;
290289

291-
mockDefaultsAndCalc(gd);
290+
beforeEach(function() {
291+
gd = createGraphDiv();
292+
});
292293

293-
expect(gd.data[0].zauto).toBe(true);
294-
expect(gd.data[0].zmin).toBe(1);
295-
expect(gd.data[0].zmax).toBe(4);
294+
afterEach(function() {
295+
destroyGraphDiv();
296+
});
296297

297-
expect(gd.data[0].autocontour).toBe(true);
298-
expect(gd.data[0].contours).toEqual({start: 0.5, end: 3.5, size: 0.5});
298+
it('should redo auto z/contour when editing z array', function() {
299+
Plotly.plot(gd, [{type: 'contour', z: [[1, 2], [3, 4]]}]).then(function() {
300+
expect(gd.data[0].zauto).toBe(true, gd.data[0]);
301+
expect(gd.data[0].zmin).toBe(1);
302+
expect(gd.data[0].zmax).toBe(4);
299303

300-
Plotly.restyle(gd, {'z[0][0]': 10});
304+
expect(gd.data[0].autocontour).toBe(true);
305+
expect(gd.data[0].contours).toEqual({start: 1.5, end: 3.5, size: 0.5});
301306

302-
expect(gd.data[0].zmin).toBe(2);
303-
expect(gd.data[0].zmax).toBe(10);
307+
return Plotly.restyle(gd, {'z[0][0]': 10});
308+
}).then(function() {
309+
expect(gd.data[0].zmin).toBe(2);
310+
expect(gd.data[0].zmax).toBe(10);
304311

305-
expect(gd.data[0].contours).toEqual({start: 3, end: 9, size: 1});
312+
expect(gd.data[0].contours).toEqual({start: 3, end: 9, size: 1});
313+
});
306314
});
307-
308315
});
309316

310317
describe('Plotly.deleteTraces', function() {

0 commit comments

Comments
 (0)