diff --git a/components/code/demos/basic.md b/components/code/demos/basic.md index 837ed9178..75da61925 100644 --- a/components/code/demos/basic.md +++ b/components/code/demos/basic.md @@ -15,13 +15,11 @@ order: 0 > > `import {CodeModule} from 'kpc-angular/@css/components/code';` - - 组件可以通过`v-model`双向绑定编辑的代码,通过`height`指定组件的高度(需要带单位),默认`100%`;通过 `language`可以指定编程语言,默认为`javasript` -> `Code`组件基于[Monaco Editor](https://github.com/Microsoft/monaco-editor),使用该组件之前,你需要 -> 安装[monaco-editor-webpack-plugin](https://github.com/Microsoft/monaco-editor-webpack-plugin)插件, +> `Code`组件基于[Monaco Editor@0.17](https://github.com/Microsoft/monaco-editor),使用该组件之前,你需要 +> 安装[monaco-editor-webpack-plugin@1.7](https://github.com/Microsoft/monaco-editor-webpack-plugin)插件, > 并加入`webpack`插件配置中 > > ```shell diff --git a/components/code/index.js b/components/code/index.js index 3a5a6ddcd..ebf9bbc34 100644 --- a/components/code/index.js +++ b/components/code/index.js @@ -68,6 +68,8 @@ export default class Code extends Intact { this.set('loading', false); this._watch(); + window.i = this; + this.trigger('ready', this); }); } @@ -115,7 +117,6 @@ function crossDomainWorker() { oldGetWorkerUrl.$ = true; window.MonacoEnvironment.getWorkerUrl = (moduleId, label) => { - debugger; const workerUrl = oldGetWorkerUrl(moduleId, label); const {isSame, url} = isSameOrigin(workerUrl); diff --git a/components/treeSelect/index.spec.js b/components/treeSelect/index.spec.js index 2115861a4..bd0127279 100644 --- a/components/treeSelect/index.spec.js +++ b/components/treeSelect/index.spec.js @@ -40,9 +40,8 @@ describe('TreeSelect', () => { expect(instance.get('values')).to.eql(['1.1']); instance.set('values', ['1']); - window.i = instance; - // expect(dropdown.innerHTML).to.matchSnapshot(); - // expect(instance.element.innerHTML).to.matchSnapshot(); + expect(dropdown.innerHTML).to.matchSnapshot(); + expect(instance.element.innerHTML).to.matchSnapshot(); }); it('checkbox', () => { diff --git a/package-lock.json b/package-lock.json index 0bbc7b2c3..da73315ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13981,17 +13981,17 @@ "dev": true }, "monaco-editor": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.20.0.tgz", - "integrity": "sha512-hkvf4EtPJRMQlPC3UbMoRs0vTAFAYdzFQ+gpMb8A+9znae1c43q8Mab9iVsgTcg/4PNiLGGn3SlDIa8uvK1FIQ==" + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.17.1.tgz", + "integrity": "sha512-JAc0mtW7NeO+0SwPRcdkfDbWLgkqL9WfP1NbpP9wNASsW6oWqgZqNIWt4teymGjZIXTElx3dnQmUYHmVrJ7HxA==" }, "monaco-editor-webpack-plugin": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-1.9.0.tgz", - "integrity": "sha512-tOiiToc94E1sb50BgZ8q8WK/bxus77SRrwCqIpAB5er3cpX78SULbEBY4YPOB8kDolOzKRt30WIHG/D6gz69Ww==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-1.7.0.tgz", + "integrity": "sha512-oItymcnlL14Sjd7EF7q+CMhucfwR/2BxsqrXIBrWL6LQplFfAfV+grLEQRmVHeGSBZ/Gk9ptzfueXnWcoEcFuA==", "dev": true, "requires": { - "loader-utils": "^1.2.3" + "@types/webpack": "^4.4.19" } }, "morgan": { diff --git a/package.json b/package.json index 7823d1173..d5c784a54 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "mermaid": "^8.3.1", "mini-css-extract-plugin": "^0.9.0", "mocha": "^5.2.0", - "monaco-editor-webpack-plugin": "^1.9.0", + "monaco-editor-webpack-plugin": "^1.7.0", "node-style-loader": "0.0.1-alpha", "null-loader": "^3.0.0", "postcss-loader": "^3.0.0", @@ -179,7 +179,7 @@ "intact": "^2.5.12", "intact-react": "^1.1.26", "intact-vue": "^0.5.6", - "monaco-editor": "^0.20.0", + "monaco-editor": "^0.17.1", "mxgraphx": "^4.0.7", "resize-observer-polyfill": "^1.5.0", "tinycolor2": "^1.4.1" diff --git a/packages/kpc-angular/package.json b/packages/kpc-angular/package.json index eacfcb790..3da9b1abd 100644 --- a/packages/kpc-angular/package.json +++ b/packages/kpc-angular/package.json @@ -37,7 +37,7 @@ "enquire.js": "^2.1.6", "intact": "^2.5.12", "intact-angular": "^0.1.3", - "monaco-editor": "^0.20.0", + "monaco-editor": "^0.17.1", "mxgraphx": "^4.0.7", "resize-observer-polyfill": "^1.5.0", "tinycolor2": "^1.4.1", diff --git a/packages/kpc-react/package.json b/packages/kpc-react/package.json index 064f5d8f3..bb5668bc4 100644 --- a/packages/kpc-react/package.json +++ b/packages/kpc-react/package.json @@ -35,7 +35,7 @@ "enquire.js": "^2.1.6", "intact": "^2.5.12", "intact-react": "^1.1.26", - "monaco-editor": "^0.20.0", + "monaco-editor": "^0.17.1", "mxgraphx": "^4.0.7", "resize-observer-polyfill": "^1.5.0", "tinycolor2": "^1.4.1" diff --git a/packages/kpc-vue/package.json b/packages/kpc-vue/package.json index 936c409da..732706158 100644 --- a/packages/kpc-vue/package.json +++ b/packages/kpc-vue/package.json @@ -35,7 +35,7 @@ "enquire.js": "^2.1.6", "intact": "^2.5.12", "intact-vue": "^0.5.6", - "monaco-editor": "^0.20.0", + "monaco-editor": "^0.17.1", "mxgraphx": "^4.0.7", "resize-observer-polyfill": "^1.5.0", "tinycolor2": "^1.4.1" diff --git a/test/utils.js b/test/utils.js index 7adcc29fb..945e4c01d 100644 --- a/test/utils.js +++ b/test/utils.js @@ -87,6 +87,9 @@ export function testDemos(req, test) { value.forEach(value => { it(value.title, async () => { await test(value.Demo); + // if (key === 'code') { + // await wait(1000); + // } }); }); }); diff --git a/test/webpack.js b/test/webpack.js index 61bb71bb7..f4d0b76fd 100644 --- a/test/webpack.js +++ b/test/webpack.js @@ -9,25 +9,29 @@ const {destData} = require('../build/doc/webpack'); exports.webpackConfig = () => { const config = genConfig(); - config - .module - .rule('istanbulJs') - .test(/^((?!(spec|mxgraph)).)*\.js$/) - .include.add(resolve('./components')).end() - .enforce('post') - .use('istanbul') - .loader('istanbul-instrumenter-loader') - .options({esModules: true}) + if (process.env.UPDATE || process.env.CI) { + config + .module + .rule('istanbulJs') + .test(/^((?!(spec|mxgraph)).)*\.js$/) + .include.add(resolve('./components')).end() + .enforce('post') + .use('istanbul') + .loader('istanbul-instrumenter-loader') + .options({esModules: true}) + .end() .end() - .end() - .rule('istanbulVdt') - .test(/^((?!site).)*\.vdt$/) - .enforce('post') - .use('istanbul') - .merge(config.module.rules.get('istanbulJs').uses.get('istanbul').entries()) + .rule('istanbulVdt') + .test(/^((?!site).)*\.vdt$/) + .enforce('post') + .use('istanbul') + .merge(config.module.rules.get('istanbulJs').uses.get('istanbul').entries()) + .end() .end() .end() - .end() + } + + config .resolve .alias .set('~', destData)