Browse Source
* Run snapshot testing against all demos * Split demo tests * ignore coverage folder * Upgrade antd-demo-jest * enable cache * intergate with coveralls.io * Add node test * Set worker to 2 https://github.com/facebook/jest/issues/1742 * config coverage * Set default supportServerRender to truepull/3953/head
Wei Zhu
8 years ago
committed by
Benjy Cui
60 changed files with 219 additions and 18 deletions
@ -1,3 +1,6 @@ |
|||
{ |
|||
"presets": ["es2015", "react", "stage-0"] |
|||
"presets": ["es2015", "react", "stage-0"], |
|||
"plugins": [ |
|||
"add-module-exports" |
|||
] |
|||
} |
|||
|
@ -0,0 +1,15 @@ |
|||
{ |
|||
"moduleFileExtensions": [ |
|||
"ts", |
|||
"tsx", |
|||
"js", |
|||
"md" |
|||
], |
|||
"transform": { |
|||
"\\.tsx?$": "node_modules/typescript-babel-jest", |
|||
"tests/.*\\.js$": "node_modules/babel-jest", |
|||
"\\.md$": "node_modules/antd-demo-jest" |
|||
}, |
|||
"testRegex": "/tests/node/.*\\.test\\.js$", |
|||
"testEnvironment": "node" |
|||
} |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('affix'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('alert'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('anchor'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('auto-complete'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('back-top'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('badge'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('breadcrumb'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('button'); |
@ -1,7 +1,7 @@ |
|||
import React from 'react'; |
|||
import { render } from 'enzyme'; |
|||
import { renderToJson } from 'enzyme-to-json'; |
|||
import Button from '../components/button/button'; |
|||
import Button from '../../components/button'; |
|||
|
|||
describe('Button', function() { |
|||
it('renders correctly', () => { |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('calendar'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('card'); |
@ -0,0 +1,12 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
// https://github.com/WickyNilliams/enquire.js/issues/82
|
|||
window.matchMedia = window.matchMedia || function() { |
|||
return { |
|||
matches : false, |
|||
addListener : function() {}, |
|||
removeListener: function() {} |
|||
}; |
|||
}; |
|||
|
|||
demoTest('carousel'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('checkbox'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('collapse'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('date-picker'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('dropdown'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('form'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('grid'); |
@ -1,7 +1,7 @@ |
|||
import React from 'react'; |
|||
import TestUtils from 'react-addons-test-utils'; |
|||
import { wrap } from 'react-stateless-wrapper'; |
|||
import AntIcon from '../components/icon/index'; |
|||
import AntIcon from '../../components/icon/index'; |
|||
const Icon = wrap(AntIcon); |
|||
|
|||
describe('Icon', function() { |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('input-number'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('input'); |
@ -1,6 +1,6 @@ |
|||
import React from 'react'; |
|||
import TestUtils from 'react-addons-test-utils'; |
|||
let { Col, Row } = require('../components/grid/index'); |
|||
let { Col, Row } = require('../../components/grid/index'); |
|||
|
|||
describe('Grid', function() { |
|||
it('should render Col', () => { |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('locale-provider'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('mention', { skip: true }); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('menu', { skip: true }); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('message'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('modal'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('notification'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('pagination'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('popconfirm'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('popover'); |
@ -1,6 +1,6 @@ |
|||
import React from 'react'; |
|||
import TestUtils from 'react-addons-test-utils'; |
|||
import Popover from '../components/popover/index'; |
|||
import Popover from '../../components/popover/index'; |
|||
|
|||
describe('Popover', function() { |
|||
it('should show overlay when trigger is clicked', () => { |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('progress'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('radio'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('rate'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('select'); |
@ -0,0 +1,16 @@ |
|||
import glob from 'glob' |
|||
import { render } from 'enzyme'; |
|||
import { renderToJson } from 'enzyme-to-json'; |
|||
|
|||
export default function demoTest(component, options = {}) { |
|||
const testMethod = options.skip ? test.skip : test; |
|||
const files = glob.sync(`./components/${component}/demo/*.md`); |
|||
|
|||
files.forEach(file => { |
|||
testMethod(`renders ${file} correctly`, () => { |
|||
const demo = require('../.' + file); |
|||
const wrapper = render(demo); |
|||
expect(renderToJson(wrapper)).toMatchSnapshot(); |
|||
}); |
|||
}); |
|||
} |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('slider'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('spin'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('steps'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('switch'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('table'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('tabs'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('tag'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('time-picker'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('timeline'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('tooltip'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('transfer'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('tree-select'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('tree'); |
@ -0,0 +1,3 @@ |
|||
import demoTest from '../shared/demoTest'; |
|||
|
|||
demoTest('upload'); |
Loading…
Reference in new issue