mirror of
https://github.com/zhigang1992/react.git
synced 2026-03-26 06:55:07 +08:00
test: add testcase for ellipsis
This commit is contained in:
@@ -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>"
|
||||
`;
|
||||
15
components/shared/__tests__/ellipsis.test.tsx
Normal file
15
components/shared/__tests__/ellipsis.test.tsx
Normal 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()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user