ant-design/tests/button.test.js

32 lines
888 B
JavaScript
Raw Normal View History

2015-11-03 11:56:08 +08:00
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import Button from '../components/button/button';
2015-11-03 11:56:08 +08:00
describe('Button', function() {
let button;
let buttonNode;
2015-11-03 11:56:08 +08:00
beforeEach(() => {
button = TestUtils.renderIntoDocument(
<Button>Follow</Button>
);
buttonNode = TestUtils.findRenderedDOMComponentWithTag(button, 'button');
});
2015-11-03 11:56:08 +08:00
it('should set the type to button by default', () => {
expect(buttonNode.type).toBe('button');
});
2015-11-03 11:56:08 +08:00
it('should set the default className to button', () => {
expect(buttonNode.className).toBe('ant-btn');
});
2015-12-06 16:43:48 +08:00
it('should has a whitespace in two Chinese characters', () => {
button = TestUtils.renderIntoDocument(
<Button>按钮</Button>
);
buttonNode = TestUtils.findRenderedDOMComponentWithTag(button, 'button');
expect(buttonNode.textContent).toBe('按 钮');
});
2015-11-03 11:56:08 +08:00
});