Skip to content

Commit 93e6c13

Browse files
committed
Update test to correct behavior
1 parent c0da340 commit 93e6c13

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

tests/spec/select/selectSpec.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe("Select Plugin", function () {
55
});
66

77
describe("Select", function () {
8-
var browserSelect, normalInput, normalDropdown, selectInstance;
8+
let browserSelect, normalInput, normalDropdown, selectInstance;
99

1010
beforeEach(function() {
1111
$('select').formSelect();
@@ -26,7 +26,7 @@ describe("Select Plugin", function () {
2626

2727
setTimeout(function() {
2828
expect(normalDropdown).toBeVisible('Should be visible after opening.');
29-
var firstOption = normalDropdown.find('li:not(.disabled)').first();
29+
let firstOption = normalDropdown.find('li:not(.disabled)').first();
3030
click(firstOption[0]);
3131
normalInput.blur();
3232

@@ -42,7 +42,7 @@ describe("Select Plugin", function () {
4242
normalInput = $(selectInstance.wrapper).find('input.select-dropdown');
4343
normalDropdown = $(selectInstance.wrapper).find('ul.select-dropdown');
4444

45-
var firstOption = browserSelect.find('option[selected]');
45+
let firstOption = browserSelect.find('option[selected]');
4646
expect(normalInput.val()).toEqual(firstOption.text(), 'Value should be equal to preselected option.');
4747
});
4848

@@ -60,7 +60,7 @@ describe("Select Plugin", function () {
6060
click(normalInput[0]);
6161

6262
setTimeout(function() {
63-
var firstOption = normalDropdown.find('li:not(.disabled)').first();
63+
let firstOption = normalDropdown.find('li:not(.disabled)').first();
6464
click(firstOption[0]);
6565
normalInput.blur();
6666

@@ -74,7 +74,7 @@ describe("Select Plugin", function () {
7474
});
7575

7676
describe("Multiple Select", function () {
77-
var browserSelect, multipleInput, multipleDropdown, selectInstance;
77+
let browserSelect, multipleInput, multipleDropdown, selectInstance;
7878

7979
beforeEach(function() {
8080
browserSelect = $('select.multiple');
@@ -94,9 +94,9 @@ describe("Select Plugin", function () {
9494

9595
setTimeout(function() {
9696
expect(multipleDropdown).toBeVisible('Should be visible after opening.');
97-
var firstOption = multipleDropdown.find('li:not(.disabled)').first();
98-
var secondOption = multipleDropdown.find('li:not(.disabled)').eq(1);
99-
var thirdOption = multipleDropdown.find('li:not(.disabled)').eq(2);
97+
let firstOption = multipleDropdown.find('li:not(.disabled)').first();
98+
let secondOption = multipleDropdown.find('li:not(.disabled)').eq(1);
99+
let thirdOption = multipleDropdown.find('li:not(.disabled)').eq(2);
100100
click(firstOption[0]);
101101
click(document.body);
102102

@@ -122,9 +122,9 @@ describe("Select Plugin", function () {
122122

123123
setTimeout(function() {
124124
expect(multipleDropdown).toBeVisible('Should be visible after opening.');
125-
var disabledOption = multipleDropdown.find('li.disabled');
126-
var secondOption = multipleDropdown.find('li:not(.disabled)').eq(1);
127-
var thirdOption = multipleDropdown.find('li:not(.disabled)').eq(2);
125+
let disabledOption = multipleDropdown.find('li.disabled');
126+
let secondOption = multipleDropdown.find('li:not(.disabled)').eq(1);
127+
let thirdOption = multipleDropdown.find('li:not(.disabled)').eq(2);
128128

129129
click(secondOption[0]);
130130
click(thirdOption[0]);
@@ -144,14 +144,14 @@ describe("Select Plugin", function () {
144144
multipleInput = $(selectInstance.wrapper).find('input.select-dropdown');
145145
multipleDropdown = $(selectInstance.wrapper).find('ul.select-dropdown');
146146

147-
var secondOption = browserSelect.find('option[selected]').eq(0);
148-
var thirdOption = browserSelect.find('option[selected]').eq(1);
147+
let secondOption = browserSelect.find('option[selected]').eq(0);
148+
let thirdOption = browserSelect.find('option[selected]').eq(1);
149149
expect(multipleInput.val()).toEqual(secondOption.text() + ', ' + thirdOption.text(), 'Value should be equal to preselected option.');
150150
});
151151
});
152152

153153
describe("Optgroup Select", function () {
154-
var browserSelect, optInput, optDropdown, optionInOptgroup, optionAfterOptGroup, selectInstance;
154+
let browserSelect, optInput, optDropdown, optionInOptgroup, optionAfterOptGroup, selectInstance;
155155

156156
beforeEach(function() {
157157
browserSelect = $('select.optgroup');
@@ -162,7 +162,7 @@ describe("Select Plugin", function () {
162162
optInput = $(selectInstance.wrapper).find('input.select-dropdown');
163163
optDropdown = $(selectInstance.wrapper).find('ul.select-dropdown');
164164

165-
var optgroups = optDropdown.find('li.optgroup');
165+
let optgroups = optDropdown.find('li.optgroup');
166166
browserSelect.find('optgroup').each(function(i) {
167167
expect($(this).attr('label')).toEqual(optgroups.eq(i).text(), 'should generate optgroup structure.');
168168
});
@@ -176,7 +176,7 @@ describe("Select Plugin", function () {
176176

177177
setTimeout(function() {
178178
expect(optDropdown).toBeVisible('Should be visible after opening.');
179-
var secondOption = optDropdown.find('li:not(.disabled):not(.optgroup)').eq(1);
179+
let secondOption = optDropdown.find('li:not(.disabled):not(.optgroup)').eq(1);
180180
click(secondOption[0]);
181181
optInput.blur();
182182

@@ -199,9 +199,9 @@ describe("Select Plugin", function () {
199199
it("should not do anything when optgroup li clicked", function(done) {
200200
optInput = $(selectInstance.wrapper).find('input.select-dropdown');
201201
optDropdown = $(selectInstance.wrapper).find('ul.select-dropdown');
202-
var originalVal = optInput.val();
202+
let originalVal = optInput.val();
203203

204-
var optgroups = optDropdown.find('li.optgroup');
204+
let optgroups = optDropdown.find('li.optgroup');
205205
browserSelect.find('optgroup').each(function(i) {
206206
expect($(this).attr('label')).toEqual(optgroups.eq(i).text(), 'should generate optgroup structure.');
207207
});
@@ -215,12 +215,12 @@ describe("Select Plugin", function () {
215215

216216
setTimeout(function() {
217217
expect(optDropdown).toBeVisible('Should be visible after opening.');
218-
var optgroup = optDropdown.find('li.optgroup').first();
218+
let optgroup = optDropdown.find('li.optgroup').first();
219219
click(optgroup[0]);
220220
optInput.blur();
221221

222222
setTimeout(function() {
223-
expect(optDropdown).toBeHidden('Should be hidden after choosing invalid item.');
223+
expect(optDropdown).toBeVisible('Should not be hidden after choosing invalid item.');
224224
expect(optInput.val()).toEqual(originalVal, 'Value should be equal to original option.');
225225
done();
226226
}, 400);

0 commit comments

Comments
 (0)