Skip to content

Commit 36ebca9

Browse files
committed
added fix to select testfixture
1 parent 16033e5 commit 36ebca9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

tests/spec/select/selectFixture.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<select multiple class="multiple">
1616
<option value="" disabled>Choose your option</option>
1717
<option value="1">Option 1</option>
18-
<option value="2">Option 2</option>
18+
<option value="2" selected>Option 2</option>
1919
<option value="3" selected>Option 3</option>
2020
</select>
2121
<label>Materialize Select</label>

tests/spec/select/selectSpec.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,27 @@ describe("Select Plugin", function () {
6868
setTimeout(function() {
6969
expect(multipleDropdown).toBeVisible('Should be visible after opening.');
7070
var firstOption = multipleDropdown.find('li:not(.disabled)').first();
71+
var secondOption = multipleDropdown.find('li:not(.disabled)').eq(1);
7172
var thirdOption = multipleDropdown.find('li:not(.disabled)').eq(2);
7273
firstOption.click();
73-
thirdOption.click();
7474
$('body').click();
7575

7676
setTimeout(function() {
7777
expect(multipleDropdown).toBeHidden('Should be hidden after choosing item.');
78-
expect(multipleInput.val()).toEqual(firstOption[0].innerText + ', ' + thirdOption[0].innerText, 'Value should equal chosen multiple options.');
78+
expect(multipleInput.val()).toEqual(secondOption[0].innerText + ', ' + thirdOption[0].innerText + ', ' + firstOption[0].innerText, 'Value should equal chosen multiple options.');
7979
done();
8080
}, 400);
8181
}, 400);
8282
});
8383

84+
it("should have multiple pre-selected values", function () {
85+
multipleInput = browserSelect.parent().find('input.select-dropdown');
86+
multipleDropdown = browserSelect.parent().find('ul.select-dropdown');
87+
88+
var secondOption = browserSelect.find('option[selected]').eq(0);
89+
var thirdOption = browserSelect.find('option[selected]').eq(1);
90+
expect(multipleInput.val()).toEqual(secondOption.text() + ', ' + thirdOption.text(), 'Value should be equal to preselected option.');
91+
});
8492
});
8593

8694
describe("Optgroup Select", function () {

0 commit comments

Comments
 (0)