| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /laragon/www/ayongundang/assets/admin/vendor/select2/tests/dropdown/ |
Upload File : |
module('Dropdown - attachBody - dropdownParent option');
test('can be a selector string', function (assert) {
assert.expect(1);
var $ = require('jquery');
var $select = $('<select></select>');
var $parent = $('<div id="parent"></div>');
$('#qunit-fixture').append($parent);
var Utils = require('select2/utils');
var Options = require('select2/options');
var Dropdown = require('select2/dropdown');
var AttachBody = require('select2/dropdown/attachBody');
var DropdownAdapter = Utils.Decorate(Dropdown, AttachBody);
var dropdown = new DropdownAdapter($select, new Options({
dropdownParent: '#parent'
}));
assert.equal(
dropdown.$dropdownParent[0],
$parent[0],
'Should be parsed using the selector as a jQuery object'
);
});
test('can be a jQuery object', function (assert) {
assert.expect(1);
var $ = require('jquery');
var $select = $('<select></select>');
var $parent = $('<div id="parent"></div>');
$('#qunit-fixture').append($parent);
var Utils = require('select2/utils');
var Options = require('select2/options');
var Dropdown = require('select2/dropdown');
var AttachBody = require('select2/dropdown/attachBody');
var DropdownAdapter = Utils.Decorate(Dropdown, AttachBody);
var dropdown = new DropdownAdapter($select, new Options({
dropdownParent: $parent
}));
assert.equal(
dropdown.$dropdownParent[0],
$parent[0],
'Should just take the passed in jQuery object'
);
});
test('defaults to the document body', function (assert) {
assert.expect(1);
var $ = require('jquery');
var $select = $('<select></select>');
var Utils = require('select2/utils');
var Options = require('select2/options');
var Dropdown = require('select2/dropdown');
var AttachBody = require('select2/dropdown/attachBody');
var DropdownAdapter = Utils.Decorate(Dropdown, AttachBody);
var dropdown = new DropdownAdapter($select, new Options({}));
assert.equal(
dropdown.$dropdownParent[0],
document.body,
'Should default to wrapping document.body'
);
});