Typeahead for tags with selectize.

Fixes #12
This commit is contained in:
Tim Schumacher 2015-04-11 11:29:53 +02:00
parent 3a862e7432
commit faad41f5e2
94 changed files with 37138 additions and 4 deletions

View file

@ -0,0 +1,64 @@
describe('DOM Events', function() {
describe('"change"', function() {
it('should be triggered once by addItem()', function(done) {
var test = setup_test('<select>', {
valueField: 'value',
labelField: 'value',
options: [
{value: 'a'},
{value: 'b'},
],
items: ['a']
});
var counter = 0;
test.$select.on('change', function() { counter++; });
test.selectize.addItem('b');
window.setTimeout(function() {
expect(counter).to.be.equal(1);
done();
}, 0);
});
it('should be triggered once by removeItem()', function(done) {
var test = setup_test('<select multiple>', {
valueField: 'value',
labelField: 'value',
options: [
{value: 'a'},
{value: 'b'},
],
items: ['a','b']
});
var counter = 0;
test.$select.on('change', function() { counter++; });
test.selectize.removeItem('b');
window.setTimeout(function() {
expect(counter).to.be.equal(1);
done();
}, 0);
});
it('should be triggered once by clear()', function(done) {
var test = setup_test('<select multiple>', {
valueField: 'value',
labelField: 'value',
options: [
{value: 'a'},
{value: 'b'},
],
items: ['a','b']
});
var counter = 0;
test.$select.on('change', function() { counter++; });
test.selectize.clear();
window.setTimeout(function() {
expect(counter).to.be.equal(1);
done();
}, 0);
});
});
});