@@ -73,10 +73,41 @@ describe("Select general interaction", () => {
73
73
assert . strictEqual ( inputResult . getProperty ( "value" ) , "5" , "Change event should have fired twice" ) ;
74
74
} ) ;
75
75
76
+ it ( "tests selection does not cycle with ArrowDown" , ( ) => {
77
+ const select = $ ( "#selectionNotCycling" ) ;
78
+ const EXPECTED_SELECTION_TEXT = "Opt3" ;
79
+ const selectOptionText = select . shadow$ ( "ui5-label" ) ;
80
+
81
+ select . click ( ) ;
82
+ assert . ok ( selectOptionText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT ) > - 1 , "Selected option text is " + EXPECTED_SELECTION_TEXT ) ;
83
+
84
+ // The last item is already selected - pressing ArrowDown should not change the focus or the selection
85
+ select . keys ( "ArrowDown" ) ;
86
+ assert . ok ( selectOptionText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT ) > - 1 , "Selected option text remains " + EXPECTED_SELECTION_TEXT ) ;
87
+
88
+ // Close the select not to cover other components that tests would try to click
89
+ select . keys ( "Escape" ) ;
90
+
91
+ } ) ;
92
+
93
+ it ( "tests selection does not cycle with ArrowUp" , ( ) => {
94
+ const select = $ ( "#selectionNotCycling2" ) ;
95
+ const EXPECTED_SELECTION_TEXT = "Opt1" ;
96
+ const selectOptionText = select . shadow$ ( "ui5-label" ) ;
97
+
98
+ select . click ( ) ;
99
+ assert . ok ( selectOptionText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT ) > - 1 , "Selected option text is " + EXPECTED_SELECTION_TEXT ) ;
100
+
101
+ // The last item is already selected - pressing ArrowUp should not change the focus or the selection
102
+ select . keys ( "ArrowUp" ) ;
103
+ assert . ok ( selectOptionText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT ) > - 1 , "Selected option text remains " + EXPECTED_SELECTION_TEXT ) ;
104
+
105
+ // Close the select not to cover other components that tests would try to click
106
+ select . keys ( "Escape" ) ;
107
+ } ) ;
76
108
77
109
it ( "opens upon space" , ( ) => {
78
110
const btn = $ ( "#myBtn2" ) ;
79
- const select = $ ( "#mySelect" ) ;
80
111
const popover = browser . $ ( "#mySelect" ) . shadow$ ( "ui5-popover" ) ;
81
112
82
113
btn . click ( ) ;
@@ -88,7 +119,6 @@ describe("Select general interaction", () => {
88
119
89
120
it ( "toggles upon F4" , ( ) => {
90
121
const btn = $ ( "#myBtn2" ) ;
91
- const select = $ ( "#mySelect" ) ;
92
122
const popover = browser . $ ( "#mySelect" ) . shadow$ ( "ui5-popover" ) ;
93
123
94
124
btn . click ( ) ;
@@ -103,7 +133,6 @@ describe("Select general interaction", () => {
103
133
104
134
it ( "toggles upon ALT + UP" , ( ) => {
105
135
const btn = $ ( "#myBtn2" ) ;
106
- const select = $ ( "#mySelect" ) ;
107
136
const popover = browser . $ ( "#mySelect" ) . shadow$ ( "ui5-popover" ) ;
108
137
109
138
btn . click ( ) ;
0 commit comments