File tree 3 files changed +25
-4
lines changed
3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 30
30
31
31
< script src ="bin/materialize.js "> </ script >
32
32
33
+ < script src ="tests/spec/cards/cardsSpec.js "> </ script >
34
+
35
+ < script src ="tests/spec/collapsible/collapsibleSpec.js "> </ script >
36
+
33
37
< script src ="tests/spec/select/selectSpec.js "> </ script >
34
38
35
39
< script src =".grunt/grunt-contrib-jasmine/reporter.js "> </ script >
Original file line number Diff line number Diff line change 1
1
< div class ="row ">
2
2
< div class ="input-field col s12 ">
3
3
< select class ="normal ">
4
- < option value ="" disabled selected > Choose your option</ option >
4
+ < option value ="" disabled > Choose your option</ option >
5
5
< option value ="1 "> Option 1</ option >
6
6
< option value ="2 "> Option 2</ option >
7
- < option value ="3 "> Option 3</ option >
7
+ < option value ="3 " selected > Option 3</ option >
8
8
</ select >
9
9
< label > Materialize Select</ label >
10
10
</ div >
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ describe("Select Plugin", function () {
13
13
$ ( 'select' ) . not ( '.disabled' ) . material_select ( ) ;
14
14
} ) ;
15
15
16
- it ( "should open select dropdown " , function ( done ) {
16
+ it ( "should open dropdown and select option " , function ( done ) {
17
17
normalInput = browserSelect . parent ( ) . find ( 'input.select-dropdown' ) ;
18
18
normalDropdown = browserSelect . parent ( ) . find ( 'ul.select-dropdown' ) ;
19
19
@@ -26,8 +26,25 @@ describe("Select Plugin", function () {
26
26
27
27
setTimeout ( function ( ) {
28
28
expect ( normalDropdown ) . toBeVisible ( 'Should be visible after opening.' ) ;
29
- done ( ) ;
29
+ var firstOption = normalDropdown . find ( 'li:not(.disabled)' ) . first ( ) ;
30
+ firstOption . click ( ) ;
31
+ normalInput . blur ( ) ;
32
+
33
+ setTimeout ( function ( ) {
34
+ expect ( normalDropdown ) . toBeHidden ( 'Should be hidden after choosing item.' ) ;
35
+ expect ( normalInput . val ( ) ) . toEqual ( firstOption [ 0 ] . innerText , 'Value should equal chosen option.' ) ;
36
+ done ( ) ;
37
+ } , 400 ) ;
30
38
} , 400 ) ;
31
39
} ) ;
40
+
41
+ it ( "should have pre-selected value" , function ( ) {
42
+ normalInput = browserSelect . parent ( ) . find ( 'input.select-dropdown' ) ;
43
+ normalDropdown = browserSelect . parent ( ) . find ( 'ul.select-dropdown' ) ;
44
+
45
+ var firstOption = browserSelect . find ( 'option[selected]' ) ;
46
+ console . log ( normalInput . val ( ) , firstOption . text ( ) ) ;
47
+ expect ( normalInput . val ( ) ) . toEqual ( firstOption . text ( ) , 'Value should be equal to preselected option.' ) ;
48
+ } ) ;
32
49
} ) ;
33
50
} ) ;
You can’t perform that action at this time.
0 commit comments