Tune the tests for positioning
These tests did not cover the classes that should have been automatically applied to the dropdown based on the space around it. Now they both test that the dropdown should be facing down, because there is enough space below it to display the dropdown.
This commit is contained in:
parent
ecdc416635
commit
98f054fc18
@ -58,7 +58,7 @@ test('appends to the dropdown parent', function (assert) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('dropdown is positioned with static margins', function (assert) {
|
test('dropdown is positioned down with static margins', function (assert) {
|
||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
var $select = $('<select></select>');
|
var $select = $('<select></select>');
|
||||||
var $parent = $('<div></div>');
|
var $parent = $('<div></div>');
|
||||||
@ -100,6 +100,11 @@ test('dropdown is positioned with static margins', function (assert) {
|
|||||||
dropdown.position($dropdown, $container);
|
dropdown.position($dropdown, $container);
|
||||||
dropdown._showDropdown();
|
dropdown._showDropdown();
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
dropdown.$dropdown.hasClass('select2-dropdown--below'),
|
||||||
|
'The dropdown should be forced down'
|
||||||
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
$dropdown.css('top').substring(0, 2),
|
$dropdown.css('top').substring(0, 2),
|
||||||
$container.outerHeight() + 5,
|
$container.outerHeight() + 5,
|
||||||
@ -113,7 +118,7 @@ test('dropdown is positioned with static margins', function (assert) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('dropdown is positioned with absolute offsets', function (assert) {
|
test('dropdown is positioned down with absolute offsets', function (assert) {
|
||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
var $select = $('<select></select>');
|
var $select = $('<select></select>');
|
||||||
var $parent = $('<div></div>');
|
var $parent = $('<div></div>');
|
||||||
@ -153,6 +158,11 @@ test('dropdown is positioned with absolute offsets', function (assert) {
|
|||||||
dropdown.position($dropdown, $container);
|
dropdown.position($dropdown, $container);
|
||||||
dropdown._showDropdown();
|
dropdown._showDropdown();
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
dropdown.$dropdown.hasClass('select2-dropdown--below'),
|
||||||
|
'The dropdown should be forced down'
|
||||||
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
$dropdown.css('top').substring(0, 2),
|
$dropdown.css('top').substring(0, 2),
|
||||||
$container.outerHeight(),
|
$container.outerHeight(),
|
||||||
|
Loading…
Reference in New Issue
Block a user