Skip to content

Commit 98f054f

Browse files
committed
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.
1 parent ecdc416 commit 98f054f

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

tests/dropdown/positioning-tests.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ test('appends to the dropdown parent', function (assert) {
5858
);
5959
});
6060

61-
test('dropdown is positioned with static margins', function (assert) {
61+
test('dropdown is positioned down with static margins', function (assert) {
6262
var $ = require('jquery');
6363
var $select = $('<select></select>');
6464
var $parent = $('<div></div>');
@@ -100,6 +100,11 @@ test('dropdown is positioned with static margins', function (assert) {
100100
dropdown.position($dropdown, $container);
101101
dropdown._showDropdown();
102102

103+
assert.ok(
104+
dropdown.$dropdown.hasClass('select2-dropdown--below'),
105+
'The dropdown should be forced down'
106+
);
107+
103108
assert.equal(
104109
$dropdown.css('top').substring(0, 2),
105110
$container.outerHeight() + 5,
@@ -113,7 +118,7 @@ test('dropdown is positioned with static margins', function (assert) {
113118
);
114119
});
115120

116-
test('dropdown is positioned with absolute offsets', function (assert) {
121+
test('dropdown is positioned down with absolute offsets', function (assert) {
117122
var $ = require('jquery');
118123
var $select = $('<select></select>');
119124
var $parent = $('<div></div>');
@@ -153,6 +158,11 @@ test('dropdown is positioned with absolute offsets', function (assert) {
153158
dropdown.position($dropdown, $container);
154159
dropdown._showDropdown();
155160

161+
assert.ok(
162+
dropdown.$dropdown.hasClass('select2-dropdown--below'),
163+
'The dropdown should be forced down'
164+
);
165+
156166
assert.equal(
157167
$dropdown.css('top').substring(0, 2),
158168
$container.outerHeight(),

0 commit comments

Comments
 (0)