2014-09-21 23:33:24 +04:00
|
|
|
module('Data adapters - Base');
|
2014-09-21 23:05:26 +04:00
|
|
|
|
2014-09-21 23:33:24 +04:00
|
|
|
var BaseData = require('select2/data/base');
|
|
|
|
var $ = require('jquery');
|
|
|
|
var Options = require('select2/options');
|
2014-09-21 23:05:26 +04:00
|
|
|
|
|
|
|
var options = new Options({});
|
|
|
|
|
2014-09-21 23:33:24 +04:00
|
|
|
test('current is required', function (assert) {
|
|
|
|
var data = new BaseData($('#qunit-fixture select'), options);
|
2014-09-21 23:05:26 +04:00
|
|
|
|
|
|
|
assert.throws(
|
|
|
|
function () {
|
|
|
|
data.current(function () {});
|
|
|
|
},
|
2014-09-21 23:33:24 +04:00
|
|
|
'current has no default implementation'
|
|
|
|
);
|
2014-09-21 23:05:26 +04:00
|
|
|
});
|
|
|
|
|
2014-09-21 23:33:24 +04:00
|
|
|
test('query is required', function (assert) {
|
|
|
|
var data = new BaseData($('#qunit-fixture select'), options);
|
2014-09-21 23:05:26 +04:00
|
|
|
|
|
|
|
assert.throws(
|
|
|
|
function () {
|
|
|
|
data.query({}, function () {});
|
|
|
|
},
|
2014-09-21 23:33:24 +04:00
|
|
|
'query has no default implementation'
|
2014-09-21 23:05:26 +04:00
|
|
|
);
|
|
|
|
});
|