偏右
8 years ago
committed by
GitHub
3 changed files with 30 additions and 20 deletions
@ -0,0 +1,19 @@ |
|||
exports[`Button renders Chinese characters correctly 1`] = ` |
|||
<button |
|||
class="ant-btn" |
|||
type="button"> |
|||
<span> |
|||
按 钮 |
|||
</span> |
|||
</button> |
|||
`; |
|||
|
|||
exports[`Button renders correctly 1`] = ` |
|||
<button |
|||
class="ant-btn" |
|||
type="button"> |
|||
<span> |
|||
Follow |
|||
</span> |
|||
</button> |
|||
`; |
@ -1,31 +1,20 @@ |
|||
import React from 'react'; |
|||
import TestUtils from 'react-addons-test-utils'; |
|||
import { render } from 'enzyme'; |
|||
import { renderToJson } from 'enzyme-to-json'; |
|||
import Button from '../components/button/button'; |
|||
|
|||
describe('Button', function() { |
|||
let button; |
|||
let buttonNode; |
|||
|
|||
beforeEach(() => { |
|||
button = TestUtils.renderIntoDocument( |
|||
it('renders correctly', () => { |
|||
const wrapper = render( |
|||
<Button>Follow</Button> |
|||
); |
|||
buttonNode = TestUtils.findRenderedDOMComponentWithTag(button, 'button'); |
|||
}); |
|||
|
|||
it('should set the type to button by default', () => { |
|||
expect(buttonNode.type).toBe('button'); |
|||
}); |
|||
|
|||
it('should set the default className to button', () => { |
|||
expect(buttonNode.className).toBe('ant-btn'); |
|||
expect(renderToJson(wrapper)).toMatchSnapshot(); |
|||
}); |
|||
|
|||
it('should has a whitespace in two Chinese characters', () => { |
|||
button = TestUtils.renderIntoDocument( |
|||
it('renders Chinese characters correctly', () => { |
|||
const wrapper = render( |
|||
<Button>按钮</Button> |
|||
); |
|||
buttonNode = TestUtils.findRenderedDOMComponentWithTag(button, 'button'); |
|||
expect(buttonNode.textContent).toBe('按 钮'); |
|||
expect(renderToJson(wrapper)).toMatchSnapshot(); |
|||
}); |
|||
}); |
|||
|
Loading…
Reference in new issue