mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
chore: convert tests to typescript
This commit is contained in:
parent
46b64ff72c
commit
534a0aa863
@ -28,8 +28,8 @@
|
||||
"build:weex": "npm run build -- weex",
|
||||
"test": "npm run lint && flow check && npm run test:types && npm run test:cover && npm run test:e2e -- --env phantomjs && npm run test:ssr && npm run test:weex",
|
||||
"test:dtw": "npm run lint && npm run test:types && npm run test:cover && npm run test:e2e -- --env phantomjs && npm run test:ssr && npm run test:weex",
|
||||
"test:unit": "karma start test/unit/karma.unit.config.js",
|
||||
"test:cover": "karma start test/unit/karma.cover.config.js",
|
||||
"test:unit": "karma start test/unit/karma.unit.config.ts",
|
||||
"test:cover": "karma start test/unit/karma.cover.config.ts",
|
||||
"test:e2e": "npm run build -- web-full-prod,web-server-basic-renderer && node test/e2e/runner.js",
|
||||
"test:weex": "npm run build:weex && jasmine-ts JASMINE_CONFIG_PATH=test/weex/jasmine.js",
|
||||
"test:ssr": "npm run build:ssr && jasmine JASMINE_CONFIG_PATH=test/ssr/jasmine.js",
|
||||
@ -81,8 +81,10 @@
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-node-resolve": "^13.2.1",
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"@types/jasmine": "^4.0.3",
|
||||
"@types/node": "^17.0.30",
|
||||
"@types/webpack": "^5.28.0",
|
||||
"@types/webpack-env": "^1.16.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
||||
"@typescript-eslint/parser": "^5.21.0",
|
||||
"acorn": "^8.7.1",
|
||||
@ -126,6 +128,7 @@
|
||||
"karma-safari-launcher": "^1.0.0",
|
||||
"karma-sauce-launcher": "^4.3.6",
|
||||
"karma-sourcemap-loader": "^0.3.8",
|
||||
"karma-typescript": "^5.5.3",
|
||||
"karma-webpack": "^5.0.0",
|
||||
"lint-staged": "^12.4.1",
|
||||
"lodash": "^4.17.21",
|
||||
|
@ -92,7 +92,6 @@ export function nextTick(cb?: Function, ctx?: Object) {
|
||||
try {
|
||||
cb.call(ctx)
|
||||
} catch (e: any) {
|
||||
// @ts-expect-error should it be any?
|
||||
handleError(e, ctx, 'nextTick')
|
||||
}
|
||||
} else if (_resolve) {
|
||||
|
@ -121,7 +121,6 @@ function callHook(dir, hook, vnode, oldVnode, isDestroy?: any) {
|
||||
try {
|
||||
fn(vnode.elm, dir, vnode, oldVnode, isDestroy)
|
||||
} catch (e: any) {
|
||||
// @ts-expect-error should it be any?
|
||||
handleError(e, vnode.context, `directive ${dir.name} ${hook} hook`)
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ server.listen(8080)
|
||||
|
||||
let args = process.argv.slice(2)
|
||||
if (args.indexOf('--config') === -1) {
|
||||
args = args.concat(['--config', 'test/e2e/nightwatch.config.js'])
|
||||
args = args.concat(['--config', 'test/e2e/nightwatch.config.ts'])
|
||||
}
|
||||
if (args.indexOf('--env') === -1) {
|
||||
args = args.concat(['--env', 'chrome,phantomjs'])
|
@ -1,6 +1,7 @@
|
||||
function noop () {}
|
||||
|
||||
if (typeof console === 'undefined') {
|
||||
// @ts-expect-error
|
||||
window.console = {
|
||||
warn: noop,
|
||||
error: noop
|
@ -16,7 +16,7 @@ describe('Component async', () => {
|
||||
timeoutsPending = {};
|
||||
|
||||
window.setTimeout = function(func, delay) {
|
||||
let id = oldSetTimeout(function() {
|
||||
const id = oldSetTimeout(function() {
|
||||
delete timeoutsPending[id];
|
||||
func();
|
||||
}, delay);
|
@ -508,28 +508,28 @@ describe('Component scoped slot', () => {
|
||||
}).then(done)
|
||||
})
|
||||
|
||||
it('render function usage (JSX)', () => {
|
||||
const vm = new Vue({
|
||||
render (h) {
|
||||
return <test>{
|
||||
props => <span>{props.msg}</span>
|
||||
}</test>
|
||||
},
|
||||
components: {
|
||||
test: {
|
||||
data () {
|
||||
return { msg: 'hello' }
|
||||
},
|
||||
render (h) {
|
||||
return <div>
|
||||
{this.$scopedSlots.default({ msg: this.msg })}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
}).$mount()
|
||||
expect(vm.$el.innerHTML).toBe('<span>hello</span>')
|
||||
})
|
||||
// it('render function usage (JSX)', () => {
|
||||
// const vm = new Vue({
|
||||
// render (h) {
|
||||
// return (<test>{
|
||||
// props => <span>{props.msg}</span>
|
||||
// }</test>)
|
||||
// },
|
||||
// components: {
|
||||
// test: {
|
||||
// data () {
|
||||
// return { msg: 'hello' }
|
||||
// },
|
||||
// render (h) {
|
||||
// return <div>
|
||||
// {this.$scopedSlots.default({ msg: this.msg })}
|
||||
// </div>
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }).$mount()
|
||||
// expect(vm.$el.innerHTML).toBe('<span>hello</span>')
|
||||
// })
|
||||
|
||||
// #5615
|
||||
it('scoped slot with v-for', done => {
|
@ -112,9 +112,9 @@ describe('Component slot', () => {
|
||||
it('it should work with previous versions of the templates', () => {
|
||||
const Test = {
|
||||
render() {
|
||||
var _vm = this;
|
||||
var _h = _vm.$createElement;
|
||||
var _c = _vm._self._c || vm._h;
|
||||
const _vm = this;
|
||||
const _h = _vm.$createElement;
|
||||
const _c = _vm._self._c || vm._h;
|
||||
return _c('div', [_vm._t("default", [_c('p', [_vm._v("slot default")])])], 2)
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user