Skip to content

Commit 6a68155

Browse files
committed
add is-active button update test
1 parent c95b45a commit 6a68155

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/jasmine/tests/range_selector_test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,32 @@ describe('[range selector suite]', function() {
449449
expect(button.style('fill')).toEqual('rgb(255, 255, 255)');
450450
});
451451

452+
it('should update is active relayout calls', function(done) {
453+
var buttons = d3.selectAll('.button').select('rect');
454+
455+
// 'all' should be active at first
456+
checkActiveButton(buttons.size() - 1);
457+
458+
var update = {
459+
'xaxis.range[0]': (new Date(2015, 9, 30)).getTime(),
460+
'xaxis.range[1]': (new Date(2015, 10, 30)).getTime()
461+
};
462+
463+
Plotly.relayout(gd, update).then(function() {
464+
465+
// '1m' should be active after the relayout
466+
checkActiveButton(0);
467+
468+
return Plotly.relayout(gd, 'xaxis.autorange', true);
469+
}).then(function() {
470+
471+
// 'all' should be after an autoscale
472+
checkActiveButton(buttons.size() - 1);
473+
474+
done();
475+
});
476+
});
477+
452478
});
453479

454480
});

0 commit comments

Comments
 (0)