Added test for new insertTag option
This adds a basic test that ensures that the `insertTag` option works as expected.
This commit is contained in:
parent
e842797aaf
commit
db5e947664
@ -176,6 +176,26 @@ test('insertTag controls the tag location', function (assert) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('insertTag can be controlled through the options', function (assert) {
|
||||||
|
var options = new Options({
|
||||||
|
insertTag: function (data, tag) {
|
||||||
|
data.push(tag);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var data = new SelectTags($('#qunit-fixture .single'), options);
|
||||||
|
|
||||||
|
data.query({
|
||||||
|
term: 'o'
|
||||||
|
}, function (data) {
|
||||||
|
assert.equal(data.results.length, 2);
|
||||||
|
|
||||||
|
var item = data.results[1];
|
||||||
|
|
||||||
|
assert.equal(item.id, 'o');
|
||||||
|
assert.equal(item.text, 'o');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('createTag controls the tag object', function (assert) {
|
test('createTag controls the tag object', function (assert) {
|
||||||
var data = new SelectTags($('#qunit-fixture .single'), options);
|
var data = new SelectTags($('#qunit-fixture .single'), options);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user