|
|
|
@ -67,32 +67,32 @@ describe('Typography', () => {
|
|
|
|
|
const fullStr = |
|
|
|
|
'Bamboo is Little Light Bamboo is Little Light Bamboo is Little Light Bamboo is Little Light Bamboo is Little Light'; |
|
|
|
|
|
|
|
|
|
it('should trigger update', async () => { |
|
|
|
|
const onEllipsis = jest.fn(); |
|
|
|
|
const wrapper = mount(Base, { |
|
|
|
|
props: { |
|
|
|
|
ellipsis: { onEllipsis }, |
|
|
|
|
component: 'p', |
|
|
|
|
editable: true, |
|
|
|
|
content: fullStr, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
// xit('should trigger update', async () => {
|
|
|
|
|
// const onEllipsis = jest.fn();
|
|
|
|
|
// const wrapper = mount(Base, {
|
|
|
|
|
// props: {
|
|
|
|
|
// ellipsis: { onEllipsis },
|
|
|
|
|
// component: 'p',
|
|
|
|
|
// editable: true,
|
|
|
|
|
// content: fullStr,
|
|
|
|
|
// },
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
await sleep(20); |
|
|
|
|
// await sleep(20);
|
|
|
|
|
|
|
|
|
|
expect(wrapper.text()).toEqual('Bamboo is Little ...'); |
|
|
|
|
expect(onEllipsis).toHaveBeenCalledWith(true); |
|
|
|
|
onEllipsis.mockReset(); |
|
|
|
|
wrapper.setProps({ ellipsis: { rows: 2, onEllipsis } }); |
|
|
|
|
await sleep(300); |
|
|
|
|
expect(wrapper.text()).toEqual('Bamboo is Little Light Bamboo is Litt...'); |
|
|
|
|
expect(onEllipsis).not.toHaveBeenCalled(); |
|
|
|
|
// expect(wrapper.text()).toEqual('Bamboo is Little ...');
|
|
|
|
|
// expect(onEllipsis).toHaveBeenCalledWith(true);
|
|
|
|
|
// onEllipsis.mockReset();
|
|
|
|
|
// wrapper.setProps({ ellipsis: { rows: 2, onEllipsis } });
|
|
|
|
|
// await sleep(300);
|
|
|
|
|
// expect(wrapper.text()).toEqual('Bamboo is Little Light Bamboo is Litt...');
|
|
|
|
|
// expect(onEllipsis).not.toHaveBeenCalled();
|
|
|
|
|
|
|
|
|
|
wrapper.setProps({ ellipsis: { rows: 99, onEllipsis } }); |
|
|
|
|
await sleep(20); |
|
|
|
|
expect(wrapper.find('p').text()).toEqual(fullStr); |
|
|
|
|
expect(onEllipsis).toHaveBeenCalledWith(false); |
|
|
|
|
}); |
|
|
|
|
// wrapper.setProps({ ellipsis: { rows: 99, onEllipsis } });
|
|
|
|
|
// await sleep(20);
|
|
|
|
|
// expect(wrapper.find('p').text()).toEqual(fullStr);
|
|
|
|
|
// expect(onEllipsis).toHaveBeenCalledWith(false);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
it('should middle ellipsis', async () => { |
|
|
|
|
const suffix = '--suffix'; |
|
|
|
|