@@ -124,3 +124,63 @@ describe("MultiInput general interaction", () => {
124
124
assert . strictEqual ( mi . $$ ( "ui5-token" ) . length , 1 , "a token is added after selection" ) ;
125
125
} ) ;
126
126
} ) ;
127
+
128
+ describe ( "ARIA attributes" , ( ) => {
129
+ it ( "aria-describedby value according to the tokens count" , ( ) => {
130
+ const mi = $ ( "#no-tokens" ) ;
131
+ const innerInput = mi . shadow$ ( "input" ) ;
132
+ const btn = $ ( "#add-tokens" ) ;
133
+ const invisibleText = mi . shadow$ ( ".ui5-hidden-text" ) ;
134
+ const inivisbleTextId = invisibleText . getProperty ( "id" ) ;
135
+ let resourceBundleText = null ;
136
+
137
+ resourceBundleText = browser . execute ( ( ) => {
138
+ const mi = document . getElementById ( "no-tokens" ) ;
139
+ return mi . i18nBundle . getText ( "TOKENIZER_ARIA_CONTAIN_TOKEN" ) ;
140
+ } ) ;
141
+
142
+ assert . strictEqual ( mi . $$ ( "ui5-token" ) . length , 0 , "should not have tokens" ) ;
143
+ assert . strictEqual ( innerInput . getAttribute ( "aria-describedby" ) , inivisbleTextId , "aria-describedby reference is correct" ) ;
144
+ assert . strictEqual ( invisibleText . getText ( ) , resourceBundleText , "aria-describedby text is correct" ) ;
145
+
146
+ $ ( "#add-tokens" ) . scrollIntoView ( ) ;
147
+ btn . click ( ) ;
148
+
149
+ resourceBundleText = browser . execute ( ( ) => {
150
+ const mi = document . getElementById ( "no-tokens" ) ;
151
+ return mi . i18nBundle . getText ( "TOKENIZER_ARIA_CONTAIN_ONE_TOKEN" ) ;
152
+ } ) ;
153
+
154
+ assert . strictEqual ( mi . $$ ( "ui5-token" ) . length , 1 , "should have one token" ) ;
155
+ assert . strictEqual ( invisibleText . getText ( ) , resourceBundleText , "aria-describedby text is correct" ) ;
156
+
157
+ btn . click ( ) ;
158
+ assert . strictEqual ( mi . $$ ( "ui5-token" ) . length , 2 , "should have two tokens" ) ;
159
+ assert . strictEqual ( invisibleText . getText ( ) , "Contains 2 tokens" , "aria-describedby text is correct" ) ;
160
+ } ) ;
161
+
162
+ it ( "aria-describedby value according to the tokens and suggestions count" , ( ) => {
163
+ const mi = $ ( "#suggestion-token" ) ;
164
+ const innerInput = mi . shadow$ ( "input" ) ;
165
+ const tokensCountITextId = `${ mi . getProperty ( "_id" ) } -hiddenText-nMore` ;
166
+ const suggestionsITextId = `${ mi . getProperty ( "_id" ) } -suggestionsText` ;
167
+ const suggestionsCountITextId = `${ mi . getProperty ( "_id" ) } -suggestionsCount` ;
168
+ const ariaDescribedBy = `${ tokensCountITextId } ${ suggestionsITextId } ${ suggestionsCountITextId } ` ;
169
+
170
+ $ ( "#suggestion-token" ) . scrollIntoView ( ) ;
171
+ innerInput . click ( ) ;
172
+ innerInput . keys ( "a" ) ;
173
+ innerInput . keys ( "ArrowDown" ) ;
174
+ innerInput . keys ( "Enter" ) ;
175
+
176
+ assert . strictEqual ( innerInput . getAttribute ( "aria-describedby" ) , ariaDescribedBy , "aria-describedby attribute contains multiple references" ) ;
177
+ } ) ;
178
+
179
+ it ( "aria-roledescription is set properly" , ( ) => {
180
+ const mi = $ ( "#no-tokens" ) ;
181
+ const innerInput = mi . shadow$ ( "input" ) ;
182
+
183
+ assert . strictEqual ( innerInput . getAttribute ( "aria-roledescription" ) , "Multi Value Input" , "aria-roledescription value is correct" ) ;
184
+ } ) ;
185
+ } ) ;
186
+
0 commit comments