Skip to content

Commit 3870503

Browse files
committed
update non-finance tests for finance refactor
1 parent 84c36a9 commit 3870503

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

test/jasmine/tests/axes_test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ describe('Test axes', function() {
183183
_has: Plots._hasPlotType,
184184
_basePlotModules: [],
185185
_dfltTitle: {x: 'x', y: 'y'},
186-
_subplots: {cartesian: ['xy'], xaxis: ['x'], yaxis: ['y']}
186+
_subplots: {cartesian: ['xy'], xaxis: ['x'], yaxis: ['y']},
187+
_requestRangeslider: {}
187188
};
188189
fullData = [];
189190
});

test/jasmine/tests/box_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe('Test box hover:', function() {
172172

173173
return Plotly.plot(gd, fig).then(function() {
174174
mouseEvent('mousemove', pos[0], pos[1]);
175-
assertHoverLabelContent(specs);
175+
assertHoverLabelContent(specs, specs.desc);
176176
});
177177
}
178178

test/jasmine/tests/plot_api_test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -2963,10 +2963,7 @@ describe('Test plot api', function() {
29632963
return Plotly.react(gd, mock);
29642964
})
29652965
.then(function() {
2966-
// TODO: remove this exemption once we fix finance
2967-
if(mockSpec[0] !== 'finance_style') {
2968-
expect(fullJson()).toEqual(initialJson);
2969-
}
2966+
expect(fullJson()).toEqual(initialJson);
29702967
countCalls({});
29712968
})
29722969
.catch(failTest)

test/jasmine/tests/range_slider_test.js

+27
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var Plotly = require('@lib/index');
22
var Lib = require('@src/lib');
33
var setConvert = require('@src/plots/cartesian/set_convert');
4+
var name2id = require('@src/plots/cartesian/axis_ids').name2id;
45

56
var RangeSlider = require('@src/components/rangeslider');
67
var constants = require('@src/components/rangeslider/constants');
@@ -509,7 +510,11 @@ describe('Rangeslider handleDefaults function', function() {
509510

510511
function _supply(layoutIn, layoutOut, axName) {
511512
setConvert(layoutOut[axName]);
513+
layoutOut[axName]._id = name2id(axName);
514+
if(!layoutOut._requestRangeslider) layoutOut._requestRangeslider = {};
512515
RangeSlider.handleDefaults(layoutIn, layoutOut, axName);
516+
// we don't care about this after it's done its job
517+
delete layoutOut._requestRangeslider;
513518
}
514519

515520
it('should not coerce anything if rangeslider isn\'t set', function() {
@@ -519,6 +524,7 @@ describe('Rangeslider handleDefaults function', function() {
519524

520525
_supply(layoutIn, layoutOut, 'xaxis');
521526
expect(layoutIn).toEqual(expected);
527+
expect(layoutOut.xaxis.rangeslider).toBeUndefined();
522528
});
523529

524530
it('should not mutate layoutIn', function() {
@@ -547,6 +553,27 @@ describe('Rangeslider handleDefaults function', function() {
547553
expect(layoutOut.xaxis.rangeslider).toEqual(expected);
548554
});
549555

556+
it('should set defaults if rangeslider is requested', function() {
557+
var layoutIn = { xaxis: {}},
558+
layoutOut = { xaxis: {}, _requestRangeslider: {x: true} },
559+
expected = {
560+
visible: true,
561+
autorange: true,
562+
thickness: 0.15,
563+
bgcolor: '#fff',
564+
borderwidth: 0,
565+
bordercolor: '#444',
566+
_input: {}
567+
};
568+
569+
_supply(layoutIn, layoutOut, 'xaxis');
570+
// in fact we DO mutate layoutIn - which we should probably try not to do,
571+
// but that's a problem for another time.
572+
// see https://github.com/plotly/plotly.js/issues/1473
573+
expect(layoutIn).toEqual({xaxis: {rangeslider: {}}});
574+
expect(layoutOut.xaxis.rangeslider).toEqual(expected);
575+
});
576+
550577
it('should set defaults if rangeslider.visible is true', function() {
551578
var layoutIn = { xaxis: { rangeslider: { visible: true }} },
552579
layoutOut = { xaxis: { rangeslider: {}} },

0 commit comments

Comments
 (0)