test: add testcase for ellipsis

This commit is contained in:
unix
2020-05-28 21:00:57 +08:00
parent d2b8e58dd6
commit c5a9b721c8
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Ellipsis should render correctly 1`] = `
"<div style=\\"width: 1px;\\"><span>text<style>
span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}
</style></span></div>"
`;

View File

@@ -0,0 +1,15 @@
import React from 'react'
import { mount } from 'enzyme'
import Ellipsis from '../ellipsis'
describe('Ellipsis', () => {
it('should render correctly', () => {
const wrapper = mount(
<div style={{ width: '1px' }}>
<Ellipsis>text</Ellipsis>
</div>,
)
expect(wrapper.html()).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
})