ant-design/tests/button.test.js
偏右 51da9c637c test: fix jest test for typescript (#3169)
* fix jest test for typescript

* fix components detect tc

* remove console
2016-09-27 13:40:34 +08:00

32 lines
887 B
JavaScript

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import Button from '../components/button/button';
describe('Button', function() {
let button;
let buttonNode;
beforeEach(() => {
button = TestUtils.renderIntoDocument(
<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');
});
it('should has a whitespace in two Chinese charactor', () => {
button = TestUtils.renderIntoDocument(
<Button>按钮</Button>
);
buttonNode = TestUtils.findRenderedDOMComponentWithTag(button, 'button');
expect(buttonNode.textContent).toBe('按 钮');
});
});