@@ -2,6 +2,7 @@ import Title from "@ui5/webcomponents/dist/Title.js";
22import Search from "../../src/Search.js" ;
33import SearchItem from "../../src/SearchItem.js" ;
44import SearchItemGroup from "../../src/SearchItemGroup.js" ;
5+ import SearchItemShowMore from "../../src/SearchItemShowMore.js" ;
56import history from "@ui5/webcomponents-icons/dist/history.js" ;
67import IllustratedMessage from "../../src/IllustratedMessage.js" ;
78import searchIcon from "@ui5/webcomponents-icons/dist/search.js" ;
@@ -10,6 +11,7 @@ import Button from "@ui5/webcomponents/dist/Button.js";
1011import ButtonDesign from "@ui5/webcomponents/dist/types/ButtonDesign.js" ;
1112import Avatar from "@ui5/webcomponents/dist/Avatar.js" ;
1213import AvatarSize from "@ui5/webcomponents/dist/types/AvatarSize.js" ;
14+ import { SEARCH_ITEM_SHOW_MORE_COUNT , SEARCH_ITEM_SHOW_MORE_NO_COUNT } from "../../src/generated/i18n/i18n-defaults.js" ;
1315
1416describe ( "Properties" , ( ) => {
1517 it ( "items slot with groups" , ( ) => {
@@ -179,6 +181,95 @@ describe("Properties", () => {
179181 . should ( "not.exist" ) ;
180182 } ) ;
181183
184+ it ( "tests show more item text with counter" , ( ) => {
185+ cy . mount (
186+ < Search >
187+ < SearchItem text = "List Item" > </ SearchItem >
188+ < SearchItemShowMore itemsToShowCount = { 3 } > </ SearchItemShowMore >
189+ </ Search >
190+ ) ;
191+
192+ cy . get ( "[ui5-search]" )
193+ . realClick ( )
194+ . realType ( "s" ) ;
195+
196+ cy . get ( "[ui5-search-item-show-more]" )
197+ . should ( "be.visible" ) ;
198+
199+ cy . get ( "[ui5-search-item-show-more]" )
200+ . shadow ( )
201+ . find ( "span" )
202+ . as ( "itemText" ) ;
203+
204+ cy . get ( "[ui5-search-item-show-more]" )
205+ . then ( $item => {
206+ const item = $item [ 0 ] ;
207+ const resourceBundle = ( item . constructor as any ) . i18nBundle ;
208+
209+ cy . get ( "@itemText" )
210+ . should ( "have.text" , resourceBundle . getText ( SEARCH_ITEM_SHOW_MORE_COUNT . defaultText , 3 ) ) ;
211+ } ) ;
212+
213+ cy . get ( "@itemText" )
214+ . should ( "have.class" , "ui5-search-item-show-more-text" ) ;
215+
216+ } ) ;
217+
218+ it ( "tests show more item with no counter" , ( ) => {
219+ cy . mount (
220+ < Search >
221+ < SearchItem text = "List Item" > </ SearchItem >
222+ < SearchItemShowMore > </ SearchItemShowMore >
223+ </ Search >
224+ ) ;
225+
226+ cy . get ( "[ui5-search]" )
227+ . realClick ( )
228+ . realType ( "s" ) ;
229+
230+ cy . get ( "[ui5-search-item-show-more]" )
231+ . should ( "be.visible" ) ;
232+
233+ cy . get ( "[ui5-search-item-show-more]" )
234+ . shadow ( )
235+ . find ( "span" )
236+ . as ( "itemText" ) ;
237+
238+ cy . get ( "[ui5-search-item-show-more]" )
239+ . then ( $item => {
240+ const item = $item [ 0 ] ;
241+ const resourceBundle = ( item . constructor as any ) . i18nBundle ;
242+
243+ cy . get ( "@itemText" )
244+ . should ( "have.text" , resourceBundle . getText ( SEARCH_ITEM_SHOW_MORE_NO_COUNT . defaultText ) ) ;
245+ } ) ;
246+
247+ cy . get ( "@itemText" )
248+ . should ( "have.class" , "ui5-search-item-show-more-text" ) ;
249+ } ) ;
250+
251+ it ( "test show more item accessibility attributes" , ( ) => {
252+ cy . mount (
253+ < Search >
254+ < SearchItem text = "List Item" > </ SearchItem >
255+ < SearchItemShowMore itemsToShowCount = { 2 } > </ SearchItemShowMore >
256+ </ Search >
257+ ) ;
258+
259+ cy . get ( "[ui5-search]" )
260+ . realClick ( )
261+ . realType ( "l" ) ;
262+
263+ cy . realPress ( "ArrowDown" ) ;
264+ cy . realPress ( "ArrowDown" ) ;
265+
266+ cy . get ( "[ui5-search-item-show-more]" )
267+ . shadow ( )
268+ . find ( "li" )
269+ . should ( "have.attr" , "aria-selected" , "true" )
270+ . should ( "have.attr" , "role" , "option" ) ;
271+ } ) ;
272+
182273 it ( "tests loading property" , ( ) => {
183274 cy . mount (
184275 < Search loading = { true } >
@@ -474,7 +565,7 @@ describe("Properties", () => {
474565 . realClick ( ) ;
475566
476567 cy . realPress ( "I" ) ;
477-
568+
478569 cy . get ( "[ui5-search-item]" )
479570 . eq ( 0 )
480571 . realHover ( ) ;
0 commit comments