Skip to content

Commit 500bbbb

Browse files
committed
test: Update test case
1 parent 8458e0d commit 500bbbb

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/Overflow.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,6 @@ function Overflow<ItemType = any>(
259259
totalWidth - currentItemWidth - suffixWidth + restWidth,
260260
);
261261
break;
262-
} else if (i === lastIndex) {
263-
// Reach the end
264-
updateDisplayCount(lastIndex);
265-
setSuffixFixedStart(totalWidth - suffixWidth);
266-
break;
267262
}
268263
}
269264

tests/responsive.spec.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -172,22 +172,6 @@ describe('Overflow.Responsive', () => {
172172
});
173173

174174
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-
191175
it('ping the position', () => {
192176
const wrapper = mount(
193177
<Overflow<ItemType>
@@ -241,4 +225,26 @@ describe('Overflow.Responsive', () => {
241225
expect(wrapper.findSuffix().props().style.position).toBeFalsy();
242226
});
243227
});
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+
});
244250
});

0 commit comments

Comments
 (0)