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,35 @@
window.expect = chai.expect;
window.assert = chai.assert;
window.has_focus = function(elem) {
return !!(elem === document.activeElement);
};
var sandbox = document.createElement('form');
document.body.appendChild(sandbox);
window.setup_test = function(html, options, callback) {
if (window.test_last) window.test_last.teardown();
var $select = $(html).appendTo(sandbox).selectize(options);
var instance = $select[0].selectize;
var test = window.test_last = {
$select: $select,
callback: callback,
selectize: instance,
teardown: function() {
instance.destroy();
$select.remove();
window.test_last = null;
}
};
return test;
};
after(function() {
if (window.test_last) {
window.test_last.teardown();
}
});
$(sandbox).on('submit', function(e) { e.preventDefault(); });