do not use mouseover, use mousedown!

ref #5596
This commit is contained in:
Max Grossman
2018-12-20 09:05:23 -05:00
parent 5a1dfeec72
commit e3407d4168
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ export function uiCombobox(context, klass) {
.on('keydown.typeahead', keydown)
.on('keyup.typeahead', keyup)
.on('input.typeahead', change)
.on('mouseover', mouseover)
.on('mousedown', mousedown)
.each(addCaret);
function addCaret() {
@@ -189,7 +189,7 @@ export function uiCombobox(context, klass) {
}
function mouseover() {
function mousedown() {
// prevent the form element from blurring. it blurs on mousedown
d3_event.stopPropagation();
d3_event.preventDefault();
+3 -3
View File
@@ -90,7 +90,7 @@ describe('uiCombobox', function() {
it('adds combobox under container', function() {
input.call(combobox.data(data));
body.selectAll('.combobox-caret').dispatch('mousedown');
body.selectAll('.combobox-input').dispatch('mousedown');
expect(d3.select('.id-container > div.combobox').nodes().length).to.equal(1);
});
@@ -106,14 +106,14 @@ describe('uiCombobox', function() {
it('shows all entries when clicking on the caret', function() {
input.property('value', 'foobar').call(combobox.data(data));
body.selectAll('.combobox-caret').dispatch('mousedown');
body.selectAll('.combobox-input').dispatch('mousedown');
expect(body.selectAll('.combobox-option').size()).to.equal(5);
expect(body.selectAll('.combobox-option').text()).to.equal('foobar');
});
it('is initially shown with no selection', function() {
input.call(combobox.data(data));
body.selectAll('.combobox-caret').dispatch('mousedown');
body.selectAll('.combobox-input').dispatch('mousedown');
expect(body.selectAll('.combobox-option.selected').size()).to.equal(0);
});