2019-08-08 04:16:45 +03:00
|
|
|
QUnit.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({});
|
|
|
|
|
2019-08-08 04:16:45 +03:00
|
|
|
QUnit.test('current is required', function (assert) {
|
2014-09-21 23:33:24 +04:00
|
|
|
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
|
|
|
});
|
|
|
|
|
2019-08-08 04:16:45 +03:00
|
|
|
QUnit.test('query is required', function (assert) {
|
2014-09-21 23:33:24 +04:00
|
|
|
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
|
|
|
);
|
|
|
|
});
|