File tree Expand file tree Collapse file tree 2 files changed +22
-21
lines changed Expand file tree Collapse file tree 2 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -259,11 +259,6 @@ function Overflow<ItemType = any>(
259
259
totalWidth - currentItemWidth - suffixWidth + restWidth ,
260
260
) ;
261
261
break ;
262
- } else if ( i === lastIndex ) {
263
- // Reach the end
264
- updateDisplayCount ( lastIndex ) ;
265
- setSuffixFixedStart ( totalWidth - suffixWidth ) ;
266
- break ;
267
262
}
268
263
}
269
264
Original file line number Diff line number Diff line change @@ -172,22 +172,6 @@ describe('Overflow.Responsive', () => {
172
172
} ) ;
173
173
174
174
describe ( 'suffix' , ( ) => {
175
- it ( 'too short not to pin' , ( ) => {
176
- const wrapper = mount (
177
- < Overflow < ItemType >
178
- data = { getData ( 1 ) }
179
- itemKey = "key"
180
- renderItem = { renderItem }
181
- maxCount = "responsive"
182
- suffix = "Bamboo"
183
- /> ,
184
- ) ;
185
-
186
- wrapper . initSize ( 100 , 20 ) ;
187
-
188
- expect ( wrapper . findSuffix ( ) . props ( ) . style ) . toEqual ( { } ) ;
189
- } ) ;
190
-
191
175
it ( 'ping the position' , ( ) => {
192
176
const wrapper = mount (
193
177
< Overflow < ItemType >
@@ -241,4 +225,26 @@ describe('Overflow.Responsive', () => {
241
225
expect ( wrapper . findSuffix ( ) . props ( ) . style . position ) . toBeFalsy ( ) ;
242
226
} ) ;
243
227
} ) ;
228
+
229
+ it ( 'render rest directly' , ( ) => {
230
+ const wrapper = mount (
231
+ < Overflow < ItemType >
232
+ data = { getData ( 10 ) }
233
+ itemKey = "key"
234
+ renderItem = { renderItem }
235
+ maxCount = "responsive"
236
+ renderRawRest = { omitItems => {
237
+ return (
238
+ < Overflow . Item component = "span" className = "custom-rest" >
239
+ { omitItems . length }
240
+ </ Overflow . Item >
241
+ ) ;
242
+ } }
243
+ /> ,
244
+ ) ;
245
+
246
+ wrapper . initSize ( 100 , 20 ) ;
247
+
248
+ expect ( wrapper . find ( 'span.custom-rest' ) . text ( ) ) . toEqual ( '6' ) ;
249
+ } ) ;
244
250
} ) ;
You can’t perform that action at this time.
0 commit comments