parent
3a862e7432
commit
faad41f5e2
94 changed files with 37138 additions and 4 deletions
35
web/vendor/selectize.js/test/support/base.js
vendored
Normal file
35
web/vendor/selectize.js/test/support/base.js
vendored
Normal 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(); });
|
Reference in a new issue