Skip to content

Commit f2db0d7

Browse files
committed
add test checking that updatemenus are above sliders
1 parent 2a40921 commit f2db0d7

File tree

1 file changed

+67
-1
lines changed

1 file changed

+67
-1
lines changed

test/jasmine/tests/updatemenus_test.js

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ describe('update menus interactions', function() {
629629
}).catch(fail).then(done);
630630
});
631631

632-
it('appliesy padding on relayout', function(done) {
632+
it('applies y padding on relayout', function(done) {
633633
var x1, x2;
634634
var firstMenu = d3.select('.' + constants.headerGroupClassName);
635635
var padShift = 40;
@@ -734,3 +734,69 @@ describe('update menus interactions', function() {
734734
return button;
735735
}
736736
});
737+
738+
739+
describe('update menus interaction with other components:', function() {
740+
'use strict';
741+
742+
afterEach(destroyGraphDiv);
743+
744+
it('buttons show be drawn above sliders', function(done) {
745+
746+
Plotly.plot(createGraphDiv(), [{
747+
x: [1, 2, 3],
748+
y: [1, 2, 1]
749+
}], {
750+
sliders: [{
751+
xanchor: 'right',
752+
x: -0.05,
753+
y: 0.9,
754+
len: 0.3,
755+
steps: [{
756+
label: 'red',
757+
method: 'restyle',
758+
args: [{'line.color': 'red'}]
759+
}, {
760+
label: 'orange',
761+
method: 'restyle',
762+
args: [{'line.color': 'orange'}]
763+
}, {
764+
label: 'yellow',
765+
method: 'restyle',
766+
args: [{'line.color': 'yellow'}]
767+
}]
768+
}],
769+
updatemenus: [{
770+
buttons: [{
771+
label: 'markers and lines',
772+
method: 'restyle',
773+
args: [{ 'mode': 'markers+lines' }]
774+
}, {
775+
label: 'markers',
776+
method: 'restyle',
777+
args: [{ 'mode': 'markers' }]
778+
}, {
779+
label: 'lines',
780+
method: 'restyle',
781+
args: [{ 'mode': 'lines' }]
782+
}]
783+
}]
784+
})
785+
.then(function() {
786+
var infoLayer = d3.select('g.infolayer');
787+
var containerClassNames = ['slider-container', 'updatemenu-container'];
788+
var list = [];
789+
790+
infoLayer.selectAll('*').each(function() {
791+
var className = d3.select(this).attr('class');
792+
793+
if(containerClassNames.indexOf(className) !== -1) {
794+
list.push(className);
795+
}
796+
});
797+
798+
expect(list).toEqual(containerClassNames);
799+
})
800+
.then(done);
801+
});
802+
});

0 commit comments

Comments
 (0)