Skip to content

Commit

Permalink
Added test for selectize#301 (closes selectize#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianreavis committed Jan 30, 2015
1 parent 1e391b1 commit d3d972f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,35 @@
});
});

it('should start loading results if preload:"focus"', function(done) {
var calls_focus = 0;
var calls_load = 0;
var test = setup_test('<select>' +
'<option value="a">A</option>' +
'<option value="b">B</option>' +
'</select>', {
preload: 'focus',
load: function(query, done) {
calls_load++;
assert.equal(query, '');
setTimeout(function() {
done([{value: 'c', text: 'C'}]);
});
}
});

test.selectize.on('focus', function() {
calls_focus++;
});
click(test.selectize.$control, function() {
setTimeout(function() {
assert.equal(calls_focus, 1);
assert.equal(calls_load, 1);
done();
}, 300);
});
});

it('should open dropdown menu', function(done) {
var test = setup_test('<select>' +
'<option value="a">A</option>' +
Expand Down

0 comments on commit d3d972f

Please sign in to comment.