2016-06-06 15:45:46 +08:00
|
|
|
// Test dist files
|
|
|
|
import fs from 'fs';
|
|
|
|
import path from 'path';
|
|
|
|
|
2016-12-08 11:08:13 +08:00
|
|
|
describe('antd dist files', () => {
|
2016-06-22 22:31:00 +08:00
|
|
|
const distFilesExisted = fs.existsSync(path.join(process.cwd(), 'dist', 'antd.js'));
|
2016-06-06 15:45:46 +08:00
|
|
|
if (!distFilesExisted) {
|
2016-07-09 18:10:11 +08:00
|
|
|
it('empty test case placeholder', () => {});
|
2016-06-06 15:45:46 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-12-08 11:08:13 +08:00
|
|
|
const antd = require('../dist/antd'); // eslint-disable-line global-require
|
2017-01-03 16:15:05 +08:00
|
|
|
const antdInComponents = require('../components/'); // eslint-disable-line global-require
|
2016-06-06 15:45:46 +08:00
|
|
|
|
|
|
|
// https://github.com/ant-design/ant-design/issues/1638
|
|
|
|
// https://github.com/ant-design/ant-design/issues/1968
|
2016-12-20 23:59:29 +08:00
|
|
|
it('exports modules correctly', () => {
|
|
|
|
expect(Object.keys(antd)).toMatchSnapshot();
|
2017-01-03 16:15:05 +08:00
|
|
|
expect(Object.keys(antdInComponents)).toMatchSnapshot();
|
2016-06-06 15:45:46 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
// https://github.com/ant-design/ant-design/issues/1970
|
|
|
|
// https://github.com/ant-design/ant-design/issues/1804
|
2016-06-22 22:31:00 +08:00
|
|
|
it('should be compatible in IE8', () => {
|
|
|
|
const antdJsContent = fs.readFileSync(path.join(process.cwd(), 'dist', 'antd.js'));
|
|
|
|
expect(
|
2016-06-06 15:45:46 +08:00
|
|
|
antdJsContent.toString()
|
2016-06-22 22:31:00 +08:00
|
|
|
.indexOf('function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }')
|
|
|
|
).toBe(-1);
|
2016-12-08 11:08:13 +08:00
|
|
|
});
|
2016-06-22 22:31:00 +08:00
|
|
|
});
|