mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
parent
87e0a574c0
commit
20a6f2cd60
@ -134,7 +134,7 @@
|
||||
"demolint": "RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'",
|
||||
"lesshint": "lesshint components -r scripts/lesshint-report.js",
|
||||
"eslint-fix": "eslint --fix components test site scripts ./*.js --ext '.js,.jsx' && eslint-tinker ./components/*/demo/*.md",
|
||||
"test": "npm run lint && npm run jest && npm run dist",
|
||||
"test": "npm run lint && npm run dist && npm run jest",
|
||||
"jest": "jest",
|
||||
"pre-publish": "node ./scripts/prepub",
|
||||
"prepublish": "antd-tools run guard",
|
||||
|
90
tests/index.test.js
Normal file
90
tests/index.test.js
Normal file
@ -0,0 +1,90 @@
|
||||
// Test dist files
|
||||
import React from 'react';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
describe('antd dist files', function() {
|
||||
const distFilesExisted = fs.existsSync(path.join(process.cwd(), 'dist', 'antd.js'));
|
||||
if (!distFilesExisted) {
|
||||
return;
|
||||
}
|
||||
jest.unmock('../dist/antd');
|
||||
|
||||
// fixed jsdom miss
|
||||
if (typeof window !== 'undefined') {
|
||||
const matchMediaPolyfill = function matchMediaPolyfill() {
|
||||
return {
|
||||
matches: false,
|
||||
addListener() {
|
||||
},
|
||||
removeListener() {
|
||||
},
|
||||
};
|
||||
};
|
||||
window.matchMedia = window.matchMedia || matchMediaPolyfill;
|
||||
}
|
||||
|
||||
const antd = require('../dist/antd');
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/1638
|
||||
// https://github.com/ant-design/ant-design/issues/1968
|
||||
it('should has modules in antd', () => {
|
||||
expect('Affix' in antd).toBeTruthy();
|
||||
expect('Alert' in antd).toBeTruthy();
|
||||
expect('Badge' in antd).toBeTruthy();
|
||||
expect('Breadcrumb' in antd).toBeTruthy();
|
||||
expect('Button' in antd).toBeTruthy();
|
||||
expect('Calendar' in antd).toBeTruthy();
|
||||
expect('Card' in antd).toBeTruthy();
|
||||
expect('Carousel' in antd).toBeTruthy();
|
||||
expect('Cascader' in antd).toBeTruthy();
|
||||
expect('Checkbox' in antd).toBeTruthy();
|
||||
expect('Col' in antd).toBeTruthy();
|
||||
expect('Collapse' in antd).toBeTruthy();
|
||||
expect('DatePicker' in antd).toBeTruthy();
|
||||
expect('Dropdown' in antd).toBeTruthy();
|
||||
expect('Form' in antd).toBeTruthy();
|
||||
expect('Icon' in antd).toBeTruthy();
|
||||
expect('Input' in antd).toBeTruthy();
|
||||
expect('InputNumber' in antd).toBeTruthy();
|
||||
expect('LocaleProvider' in antd).toBeTruthy();
|
||||
expect('Menu' in antd).toBeTruthy();
|
||||
expect('message' in antd).toBeTruthy();
|
||||
expect('Modal' in antd).toBeTruthy();
|
||||
expect('notification' in antd).toBeTruthy();
|
||||
expect('Pagination' in antd).toBeTruthy();
|
||||
expect('Popconfirm' in antd).toBeTruthy();
|
||||
expect('Popover' in antd).toBeTruthy();
|
||||
expect('Progress' in antd).toBeTruthy();
|
||||
expect('QueueAnim' in antd).toBeTruthy();
|
||||
expect('Radio' in antd).toBeTruthy();
|
||||
expect('Rate' in antd).toBeTruthy();
|
||||
expect('Row' in antd).toBeTruthy();
|
||||
expect('Select' in antd).toBeTruthy();
|
||||
expect('Slider' in antd).toBeTruthy();
|
||||
expect('Spin' in antd).toBeTruthy();
|
||||
expect('Steps' in antd).toBeTruthy();
|
||||
expect('Switch' in antd).toBeTruthy();
|
||||
expect('Table' in antd).toBeTruthy();
|
||||
expect('Tabs' in antd).toBeTruthy();
|
||||
expect('Tag' in antd).toBeTruthy();
|
||||
expect('TimePicker' in antd).toBeTruthy();
|
||||
expect('Timeline' in antd).toBeTruthy();
|
||||
expect('Tooltip' in antd).toBeTruthy();
|
||||
expect('Transfer' in antd).toBeTruthy();
|
||||
expect('Tree' in antd).toBeTruthy();
|
||||
expect('TreeSelect' in antd).toBeTruthy();
|
||||
expect('Upload' in antd).toBeTruthy();
|
||||
expect('Validation' in antd).toBeTruthy();
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/1970
|
||||
// https://github.com/ant-design/ant-design/issues/1804
|
||||
it('should be compatible in IE8', () => {
|
||||
const antdJsContent = fs.readFileSync(path.join(process.cwd(), 'dist', 'antd.js'));
|
||||
expect(
|
||||
antdJsContent.toString()
|
||||
.indexOf('function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }')
|
||||
).toBe(-1);
|
||||
})
|
||||
});
|
Loading…
Reference in New Issue
Block a user