From c0dc894cbefc82db5eab0d0d6613b0a120761375 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 3 Nov 2015 11:56:08 +0800 Subject: [PATCH] Fix tests --- package.json | 1 + tests/button.test.js | 26 ++++++++++++++++++++++++++ tests/index.test.js | 2 ++ 3 files changed, 29 insertions(+) create mode 100644 tests/button.test.js diff --git a/package.json b/package.json index 06e0d13e6f..f554dfbfb0 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "babel": "^5.8.29", "babel-core": "^5.8.29", "babel-eslint": "^4.1.0", + "babel-jest": "^5.3.0", "babel-loader": "^5.3.2", "busboy": "^0.2.9", "chalk": "^1.1.0", diff --git a/tests/button.test.js b/tests/button.test.js new file mode 100644 index 0000000000..0bf66a2616 --- /dev/null +++ b/tests/button.test.js @@ -0,0 +1,26 @@ +jest.dontMock('../components/button/button'); + +import React from 'react'; +import TestUtils from 'react-addons-test-utils'; +const Button = require('../components/button/button'); + +describe('Button', function() { + let button; + let buttonNode; + + beforeEach(() => { + button = TestUtils.renderIntoDocument( + + ); + 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'); + }); +}); + diff --git a/tests/index.test.js b/tests/index.test.js index a291375334..a4dc911ff8 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -1,4 +1,6 @@ jest.dontMock('../index'); + +import React from 'react'; import antd, { Button, } from '../index';