Skip to content

Commit 77cf201

Browse files
committed
test: Add test case
1 parent 2c57814 commit 77cf201

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

tests/responsive.spec.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ describe('Overflow.Responsive', () => {
4040
wrapper.initSize(100, 20); // [0][1][2][3][4][+2](5)(6)
4141
expect(wrapper.findItems()).toHaveLength(6);
4242
[true, true, true, true, false, false].forEach((display, i) => {
43-
expect(wrapper.findItems().at(i).props().display).toBe(display);
43+
expect(
44+
wrapper
45+
.findItems()
46+
.at(i)
47+
.props().display,
48+
).toBe(display);
4449
});
4550
expect(wrapper.findRest()).toHaveLength(1);
4651
expect(wrapper.findRest().text()).toEqual('+ 2 ...');
@@ -188,5 +193,23 @@ describe('Overflow.Responsive', () => {
188193

189194
expect(wrapper.findSuffix().props().style.position).toBeFalsy();
190195
});
196+
197+
it('long to short should keep correct position', () => {
198+
const wrapper = mount(
199+
<Overflow<ItemType>
200+
data={getData(3)}
201+
itemKey="key"
202+
renderItem={renderItem}
203+
maxCount="responsive"
204+
suffix="Bamboo"
205+
/>,
206+
);
207+
208+
wrapper.initSize(20, 20);
209+
wrapper.setProps({ data: [] });
210+
211+
expect(wrapper.findRest().props().order).toEqual(Number.MAX_SAFE_INTEGER);
212+
expect(wrapper.findSuffix().props().style.position).toBeFalsy();
213+
});
191214
});
192215
});

0 commit comments

Comments
 (0)