mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 03:57:36 +08:00
chore: cleanup tweaks that would affect JS; rolled back packages folder to @pikax output
This commit is contained in:
parent
40dccfedd1
commit
e2f1ce06cf
@ -1726,6 +1726,7 @@
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// @ts-expect-error should it be any?
|
||||
handleError(e, vm, info);
|
||||
}
|
||||
return res;
|
||||
@ -5698,7 +5699,7 @@
|
||||
// $flow-disable-line
|
||||
const leadingSpaceLength = template.match(/^\s*/)[0].length;
|
||||
warn = (msg, range, tip) => {
|
||||
const data = typeof (msg) === 'string' ? { msg } : msg;
|
||||
const data = { msg };
|
||||
if (range) {
|
||||
if (range.start != null) {
|
||||
data.start = range.start + leadingSpaceLength;
|
||||
|
@ -1731,6 +1731,7 @@ function invokeWithErrorHandling(handler, context, args, vm, info) {
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// @ts-expect-error should it be any?
|
||||
handleError(e, vm, info);
|
||||
}
|
||||
return res;
|
||||
@ -5443,7 +5444,7 @@ function createCompilerCreator(baseCompile) {
|
||||
// $flow-disable-line
|
||||
const leadingSpaceLength = template.match(/^\s*/)[0].length;
|
||||
warn = (msg, range, tip) => {
|
||||
const data = typeof (msg) === 'string' ? { msg } : msg;
|
||||
const data = { msg };
|
||||
if (range) {
|
||||
if (range.start != null) {
|
||||
data.start = range.start + leadingSpaceLength;
|
||||
|
@ -4415,7 +4415,7 @@
|
||||
// $flow-disable-line
|
||||
const leadingSpaceLength = template.match(/^\s*/)[0].length;
|
||||
warn = (msg, range, tip) => {
|
||||
const data = typeof (msg) === 'string' ? { msg } : msg;
|
||||
const data = { msg };
|
||||
if (range) {
|
||||
if (range.start != null) {
|
||||
data.start = range.start + leadingSpaceLength;
|
||||
|
@ -4049,7 +4049,7 @@ function createCompilerCreator(baseCompile) {
|
||||
// $flow-disable-line
|
||||
const leadingSpaceLength = template.match(/^\s*/)[0].length;
|
||||
warn = (msg, range, tip) => {
|
||||
const data = typeof (msg) === 'string' ? { msg } : msg;
|
||||
const data = { msg };
|
||||
if (range) {
|
||||
if (range.start != null) {
|
||||
data.start = range.start + leadingSpaceLength;
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* globals */
|
||||
|
||||
declare const stats: any
|
||||
declare const valueToPoint: Function
|
||||
|
||||
@ -45,7 +43,7 @@ module.exports = {
|
||||
const point = valueToPoint(stat.value, i, 6)
|
||||
return point.x + ',' + point.y
|
||||
}).join(' ')
|
||||
return document.querySelector('polygon').attributes[0].value === points
|
||||
return document.querySelector('polygon')!.attributes[0].value === points
|
||||
})
|
||||
.end()
|
||||
}
|
||||
|
@ -52,10 +52,10 @@ beforeEach(() => {
|
||||
spyOn(console, 'error')
|
||||
jasmine.addMatchers({
|
||||
toHaveBeenWarned: () =>
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createCompareFn(console.error),
|
||||
toHaveBeenTipped: () =>
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createCompareFn(console.warn)
|
||||
})
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
global.triggerEvent = function triggerEvent (target, event, process) {
|
||||
window.triggerEvent = function triggerEvent (target, event, process) {
|
||||
const e = document.createEvent('HTMLEvents')
|
||||
e.initEvent(event, true, true)
|
||||
if (event === 'click') {
|
||||
|
@ -12,7 +12,7 @@ import Vue from 'vue'
|
||||
// // more assertions...
|
||||
// })
|
||||
// .then(done)
|
||||
// @ts-expect-error
|
||||
|
||||
window.waitForUpdate = initialCb => {
|
||||
let end
|
||||
const queue = initialCb ? [initialCb] : []
|
||||
@ -30,7 +30,7 @@ window.waitForUpdate = initialCb => {
|
||||
done.fail(e)
|
||||
}
|
||||
}
|
||||
if (!hasError && !job?.wait) {
|
||||
if (!hasError && !job!.wait) {
|
||||
if (queue.length) {
|
||||
Vue.nextTick(shift)
|
||||
}
|
||||
@ -41,7 +41,7 @@ window.waitForUpdate = initialCb => {
|
||||
}
|
||||
|
||||
Vue.nextTick(() => {
|
||||
if (!queue.length || (!end && !queue[queue.length - 1]?.fail)) {
|
||||
if (!queue.length || (!end && !queue[queue.length - 1]!.fail)) {
|
||||
throw new Error('waitForUpdate chain is missing .then(done)')
|
||||
}
|
||||
shift()
|
||||
|
@ -3,9 +3,6 @@ import webpack from 'webpack'
|
||||
import MemoryFS from 'memory-fs'
|
||||
|
||||
export function compileWithWebpack (file, extraConfig, cb) {
|
||||
if( process.env.FOOBAR !== 'blah') {
|
||||
throw new Error('die')
|
||||
}
|
||||
const config = Object.assign({
|
||||
mode: 'development',
|
||||
entry: path.resolve(__dirname, 'fixtures', file),
|
||||
|
@ -3,7 +3,8 @@ import { formatComponentName, warn } from 'core/util/debug'
|
||||
|
||||
describe('Debug utilities', () => {
|
||||
it('properly format component names', () => {
|
||||
const vm = new Vue('div')
|
||||
// @ts-expect-error
|
||||
const vm = new Vue()
|
||||
expect(formatComponentName(vm)).toBe('<Root>')
|
||||
|
||||
vm.$root = null
|
||||
@ -83,7 +84,8 @@ found in
|
||||
|
||||
describe('warn', () => {
|
||||
const msg = 'message'
|
||||
const vm = new Vue('div')
|
||||
// @ts-expect-error
|
||||
const vm = new Vue()
|
||||
|
||||
it('calls warnHandler if warnHandler is set', () => {
|
||||
Vue.config.warnHandler = jasmine.createSpy()
|
||||
|
@ -170,7 +170,8 @@ describe('Error handling', () => {
|
||||
Vue.nextTick(() => {
|
||||
expect(spy).toHaveBeenCalledWith(err1, undefined, 'nextTick')
|
||||
|
||||
const vm = new Vue('div')
|
||||
// @ts-expect-error
|
||||
const vm = new Vue()
|
||||
vm.$nextTick(() => { throw err2 })
|
||||
Vue.nextTick(() => {
|
||||
// should be called with correct instance info
|
||||
|
@ -2,11 +2,13 @@ import Vue from 'vue'
|
||||
|
||||
describe('Initialization', () => {
|
||||
it('without new', () => {
|
||||
try { Vue('div') } catch (e) {}
|
||||
// @ts-expect-error
|
||||
try { Vue() } catch (e) {}
|
||||
expect('Vue is a constructor and should be called with the `new` keyword').toHaveBeenWarned()
|
||||
})
|
||||
|
||||
it('with new', () => {
|
||||
expect(new Vue('div') instanceof Vue).toBe(true)
|
||||
// @ts-expect-error
|
||||
expect(new Vue() instanceof Vue).toBe(true)
|
||||
})
|
||||
})
|
||||
|
@ -3,7 +3,8 @@ import Vue from 'vue'
|
||||
describe('Instance methods events', () => {
|
||||
let vm, spy
|
||||
beforeEach(() => {
|
||||
vm = new Vue('div')
|
||||
// @ts-expect-error
|
||||
const vm = new Vue()
|
||||
spy = jasmine.createSpy('emitter')
|
||||
})
|
||||
|
||||
|
@ -161,7 +161,8 @@ describe('Instance properties', () => {
|
||||
})
|
||||
|
||||
it('warn mutating $attrs', () => {
|
||||
const vm = new Vue('div')
|
||||
// @ts-expect-error
|
||||
const vm = new Vue()
|
||||
vm.$attrs = {}
|
||||
expect(`$attrs is readonly`).toHaveBeenWarned()
|
||||
})
|
||||
@ -196,7 +197,8 @@ describe('Instance properties', () => {
|
||||
})
|
||||
|
||||
it('warn mutating $listeners', () => {
|
||||
const vm = new Vue('div')
|
||||
// @ts-expect-error
|
||||
const vm = new Vue()
|
||||
vm.$listeners = {}
|
||||
expect(`$listeners is readonly`).toHaveBeenWarned()
|
||||
})
|
||||
|
@ -78,7 +78,8 @@ describe('Options lifecycle hooks', () => {
|
||||
|
||||
// #3898
|
||||
it('should call for manually mounted instance with parent', () => {
|
||||
const parent = new Vue('div')
|
||||
// @ts-expect-error
|
||||
const vm = new Vue()
|
||||
expect(spy).not.toHaveBeenCalled()
|
||||
new Vue({
|
||||
parent,
|
||||
|
@ -33,7 +33,8 @@ describe('Options render', () => {
|
||||
})
|
||||
|
||||
it('should warn non `render` option and non `template` option', () => {
|
||||
new Vue('div').$mount()
|
||||
// @ts-expect-error
|
||||
new Vue().$mount()
|
||||
expect('Failed to mount component: template or render function not defined.').toHaveBeenWarned()
|
||||
})
|
||||
})
|
||||
|
@ -23,7 +23,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
|
||||
|
@ -14,7 +14,8 @@ describe('Observer', () => {
|
||||
const ob1 = observe(1)
|
||||
expect(ob1).toBeUndefined()
|
||||
// avoid vue instance
|
||||
const ob2 = observe(new Vue('div'))
|
||||
// @ts-expect-error
|
||||
const ob2 = observe(new Vue())
|
||||
expect(ob2).toBeUndefined()
|
||||
// avoid frozen objects
|
||||
const ob3 = observe(Object.freeze({}))
|
||||
|
Loading…
Reference in New Issue
Block a user