File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -174,4 +174,22 @@ describe("Pagination", () => {
174174 fixture . detectChanges ( ) ;
175175 expect ( wrapper . pageOptions ) . toEqual ( Array ( 1 ) ) ;
176176 } ) ;
177+
178+ it ( "should replace the select with a number input when the pagination threshold is reached" , ( ) => {
179+ const fixture = TestBed . createComponent ( PaginationTest ) ;
180+ const wrapper = fixture . componentInstance ;
181+ fixture . detectChanges ( ) ;
182+ element = fixture . debugElement . query ( By . css ( "cds-pagination" ) ) ;
183+
184+ element . componentInstance . pageSelectThreshold = 500 ;
185+ fixture . detectChanges ( ) ;
186+ expect ( element . nativeElement . querySelector ( ".cds--select__page-number input" ) ) . toBe ( null ) ;
187+ expect ( element . nativeElement . querySelector ( ".cds--select__page-number select" ) ) . toBeDefined ( ) ;
188+
189+ element . componentInstance . pageSelectThreshold = 2 ;
190+ fixture . detectChanges ( ) ;
191+ expect ( element . nativeElement . querySelector ( ".cds--select__page-number input" ) ) . toBeDefined ( ) ;
192+ expect ( element . nativeElement . querySelector ( ".cds--select__page-number select" ) ) . toBe ( null ) ;
193+
194+ } ) ;
177195} ) ;
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ export interface PaginationTranslations {
137137 <option *ngFor="let page of pageOptions; let i = index;" class="cds--select-option" [value]="i + 1">{{i + 1}}</option>
138138 </select>
139139 <svg
140- *ngIf="pageOptions.length <= 1000 "
140+ *ngIf="pageOptions.length <= pageSelectThreshold "
141141 cdsIcon="chevron--down"
142142 size="16"
143143 style="display: inherit;"
You can’t perform that action at this time.
0 commit comments