chore: fix typos (#1090)

This commit is contained in:
HiiTea 2020-05-01 21:42:58 +08:00 committed by GitHub
parent a6a939f5e0
commit 22717772dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 42 additions and 42 deletions

View File

@ -26,7 +26,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform v-model simple exprssion (with prefixIdentifiers) 1`] = ` exports[`compiler: transform v-model simple expression (with prefixIdentifiers) 1`] = `
"import { createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\" "import { createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
@ -37,7 +37,7 @@ export function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform v-model simple exprssion 1`] = ` exports[`compiler: transform v-model simple expression 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {

View File

@ -39,7 +39,7 @@ function parseWithVModel(template: string, options: CompilerOptions = {}) {
} }
describe('compiler: transform v-model', () => { describe('compiler: transform v-model', () => {
test('simple exprssion', () => { test('simple expression', () => {
const root = parseWithVModel('<input v-model="model" />') const root = parseWithVModel('<input v-model="model" />')
const node = root.children[0] as ElementNode const node = root.children[0] as ElementNode
const props = ((node.codegenNode as VNodeCall).props as ObjectExpression) const props = ((node.codegenNode as VNodeCall).props as ObjectExpression)
@ -76,7 +76,7 @@ describe('compiler: transform v-model', () => {
expect(generate(root).code).toMatchSnapshot() expect(generate(root).code).toMatchSnapshot()
}) })
test('simple exprssion (with prefixIdentifiers)', () => { test('simple expression (with prefixIdentifiers)', () => {
const root = parseWithVModel('<input v-model="model" />', { const root = parseWithVModel('<input v-model="model" />', {
prefixIdentifiers: true prefixIdentifiers: true
}) })
@ -377,7 +377,7 @@ describe('compiler: transform v-model', () => {
expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`) expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
}) })
test('should generate modelModifers for component v-model', () => { test('should generate modelModifiers for component v-model', () => {
const root = parseWithVModel('<Comp v-model.trim.bar-baz="foo" />', { const root = parseWithVModel('<Comp v-model.trim.bar-baz="foo" />', {
prefixIdentifiers: true prefixIdentifiers: true
}) })
@ -399,7 +399,7 @@ describe('compiler: transform v-model', () => {
expect(vnodeCall.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`) expect(vnodeCall.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
}) })
test('should generate modelModifers for component v-model with arguments', () => { test('should generate modelModifiers for component v-model with arguments', () => {
const root = parseWithVModel( const root = parseWithVModel(
'<Comp v-model:foo.trim="foo" v-model:bar.number="bar" />', '<Comp v-model:foo.trim="foo" v-model:bar.number="bar" />',
{ {

View File

@ -31,7 +31,7 @@ type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> &
Pick<ParserOptions, OptionalOptions> Pick<ParserOptions, OptionalOptions>
// The default decoder only provides escapes for characters reserved as part of // The default decoder only provides escapes for characters reserved as part of
// the tempalte syntax, and is only used if the custom renderer did not provide // the template syntax, and is only used if the custom renderer did not provide
// a platform-specific decoder. // a platform-specific decoder.
const decodeRE = /&(gt|lt|amp|apos|quot);/g const decodeRE = /&(gt|lt|amp|apos|quot);/g
const decodeMap: Record<string, string> = { const decodeMap: Record<string, string> = {

View File

@ -19,7 +19,7 @@ export function hoistStatic(root: RootNode, context: TransformContext) {
root.children, root.children,
context, context,
new Map(), new Map(),
// Root node is unfortuantely non-hoistable due to potential parent // Root node is unfortunately non-hoistable due to potential parent
// fallthrough attributes. // fallthrough attributes.
isSingleElementRoot(root, root.children[0]) isSingleElementRoot(root, root.children[0])
) )

View File

@ -75,7 +75,7 @@ describe('stringify static html', () => {
}) })
}) })
test('serliazing constant bindings', () => { test('serializing constant bindings', () => {
const { ast } = compileWithStringify( const { ast } = compileWithStringify(
`<div><div :style="{ color: 'red' }">${repeat( `<div><div :style="{ color: 'red' }">${repeat(
`<span :class="[{ foo: true }, { bar: true }]">{{ 1 }} + {{ false }}</span>`, `<span :class="[{ foo: true }, { bar: true }]">{{ 1 }} + {{ false }}</span>`,

View File

@ -19,7 +19,7 @@ export const ssrTransformFor = createStructuralDirectiveTransform(
processFor processFor
) )
// This is called during the 2nd transform pass to construct the SSR-sepcific // This is called during the 2nd transform pass to construct the SSR-specific
// codegen nodes. // codegen nodes.
export function ssrProcessFor(node: ForNode, context: SSRTransformContext) { export function ssrProcessFor(node: ForNode, context: SSRTransformContext) {
const needFragmentWrapper = const needFragmentWrapper =

View File

@ -20,7 +20,7 @@ export const ssrTransformIf = createStructuralDirectiveTransform(
processIf processIf
) )
// This is called during the 2nd transform pass to construct the SSR-sepcific // This is called during the 2nd transform pass to construct the SSR-specific
// codegen nodes. // codegen nodes.
export function ssrProcessIf(node: IfNode, context: SSRTransformContext) { export function ssrProcessIf(node: IfNode, context: SSRTransformContext) {
const [rootBranch] = node.branches const [rootBranch] = node.branches

View File

@ -759,7 +759,7 @@ describe('reactivity/effect', () => {
expect(fnSpy).toHaveBeenCalledTimes(1) expect(fnSpy).toHaveBeenCalledTimes(1)
}) })
it('should trigger all effects when array lenght is set 0', () => { it('should trigger all effects when array length is set 0', () => {
const observed: any = reactive([1]) const observed: any = reactive([1])
let dummy, record let dummy, record
effect(() => { effect(() => {

View File

@ -121,7 +121,7 @@ describe('reactivity/reactive/Array', () => {
expect(isRef(raw[1])).toBe(true) expect(isRef(raw[1])).toBe(true)
}) })
test('read + indentity', () => { test('read + identity', () => {
const ref = original[1] const ref = original[1]
expect(ref).toBe(toRaw(original)[1]) expect(ref).toBe(toRaw(original)[1])
expect(original.indexOf(ref)).toBe(1) expect(original.indexOf(ref)).toBe(1)

View File

@ -664,7 +664,7 @@ describe('BaseTransition', () => {
expect(props.onAfterEnter).toHaveBeenCalledTimes(1) expect(props.onAfterEnter).toHaveBeenCalledTimes(1)
assertCalledWithEl(props.onAfterEnter, falseSerialized) assertCalledWithEl(props.onAfterEnter, falseSerialized)
// toggele again // toggle again
toggle.value = true toggle.value = true
await nextTick() await nextTick()
expect(serializeInner(root)).toBe(`${falseSerialized}<!---->`) expect(serializeInner(root)).toBe(`${falseSerialized}<!---->`)
@ -740,7 +740,7 @@ describe('BaseTransition', () => {
await nextTick() await nextTick()
// expected behavior: the previous true branch is preserved, // expected behavior: the previous true branch is preserved,
// and a placeholder is injected for the replacement. // and a placeholder is injected for the replacement.
// the leaving node is repalced with the replace node (of the same branch) // the leaving node is replaced with the replace node (of the same branch)
// when it finishes leaving // when it finishes leaving
expect(serializeInner(root)).toBe(`${trueSerialized}<!---->`) expect(serializeInner(root)).toBe(`${trueSerialized}<!---->`)
// enter hooks should never be called (for neither branch) // enter hooks should never be called (for neither branch)

View File

@ -112,7 +112,7 @@ describe('hot module replacement', () => {
test('reload', async () => { test('reload', async () => {
const root = nodeOps.createElement('div') const root = nodeOps.createElement('div')
const childId = 'test3-child' const childId = 'test3-child'
const unmoutSpy = jest.fn() const unmountSpy = jest.fn()
const mountSpy = jest.fn() const mountSpy = jest.fn()
const Child: ComponentOptions = { const Child: ComponentOptions = {
@ -120,7 +120,7 @@ describe('hot module replacement', () => {
data() { data() {
return { count: 0 } return { count: 0 }
}, },
unmounted: unmoutSpy, unmounted: unmountSpy,
render: compileToFunction(`<div @click="count++">{{ count }}</div>`) render: compileToFunction(`<div @click="count++">{{ count }}</div>`)
} }
createRecord(childId, Child) createRecord(childId, Child)
@ -142,7 +142,7 @@ describe('hot module replacement', () => {
}) })
await nextTick() await nextTick()
expect(serializeInner(root)).toBe(`<div>1</div>`) expect(serializeInner(root)).toBe(`<div>1</div>`)
expect(unmoutSpy).toHaveBeenCalledTimes(1) expect(unmountSpy).toHaveBeenCalledTimes(1)
expect(mountSpy).toHaveBeenCalledTimes(1) expect(mountSpy).toHaveBeenCalledTimes(1)
}) })
}) })

View File

@ -653,7 +653,7 @@ describe('SSR hydration', () => {
// fragment ends early and attempts to hydrate the extra <div>bar</div> // fragment ends early and attempts to hydrate the extra <div>bar</div>
// as 2nd fragment child. // as 2nd fragment child.
expect(`Hydration text content mismatch`).toHaveBeenWarned() expect(`Hydration text content mismatch`).toHaveBeenWarned()
// exccesive children removal // excessive children removal
expect(`Hydration children mismatch`).toHaveBeenWarned() expect(`Hydration children mismatch`).toHaveBeenWarned()
}) })
}) })

View File

@ -62,7 +62,7 @@ describe('scheduler', () => {
const calls: string[] = [] const calls: string[] = []
const job1 = () => { const job1 = () => {
calls.push('job1') calls.push('job1')
// job2 will be excuted after job1 at the same tick // job2 will be executed after job1 at the same tick
queueJob(job2) queueJob(job2)
} }
const job2 = () => { const job2 = () => {
@ -123,7 +123,7 @@ describe('scheduler', () => {
const calls: string[] = [] const calls: string[] = []
const cb1 = () => { const cb1 = () => {
calls.push('cb1') calls.push('cb1')
// cb2 will be excuted after cb1 at the same tick // cb2 will be executed after cb1 at the same tick
queuePostFlushCb(cb2) queuePostFlushCb(cb2)
} }
const cb2 = () => { const cb2 = () => {

View File

@ -199,7 +199,7 @@ describe('vnode', () => {
expect(cloneVNode(node2)).toEqual(node2) expect(cloneVNode(node2)).toEqual(node2)
expect(cloneVNode(node2)).toEqual(cloned2) expect(cloneVNode(node2)).toEqual(cloned2)
// #1041 should use reoslved key/ref // #1041 should use resolved key/ref
expect(cloneVNode(createVNode('div', { key: 1 })).key).toBe(1) expect(cloneVNode(createVNode('div', { key: 1 })).key).toBe(1)
expect(cloneVNode(createVNode('div', { key: 1 }), { key: 2 }).key).toBe(2) expect(cloneVNode(createVNode('div', { key: 1 }), { key: 2 }).key).toBe(2)
expect(cloneVNode(createVNode('div'), { key: 2 }).key).toBe(2) expect(cloneVNode(createVNode('div'), { key: 2 }).key).toBe(2)
@ -260,15 +260,15 @@ describe('vnode', () => {
}) })
test('handlers', () => { test('handlers', () => {
let clickHander1 = function() {} let clickHandler1 = function() {}
let clickHander2 = function() {} let clickHandler2 = function() {}
let focusHander2 = function() {} let focusHandler2 = function() {}
let props1: Data = { onClick: clickHander1 } let props1: Data = { onClick: clickHandler1 }
let props2: Data = { onClick: clickHander2, onFocus: focusHander2 } let props2: Data = { onClick: clickHandler2, onFocus: focusHandler2 }
expect(mergeProps(props1, props2)).toMatchObject({ expect(mergeProps(props1, props2)).toMatchObject({
onClick: [clickHander1, clickHander2], onClick: [clickHandler1, clickHandler2],
onFocus: focusHander2 onFocus: focusHandler2
}) })
}) })
@ -359,7 +359,7 @@ describe('vnode', () => {
// #1039 // #1039
// <component :is="foo">{{ bar }}</component> // <component :is="foo">{{ bar }}</component>
// - content is compiled as slot // - content is compiled as slot
// - dynamic component reoslves to plain element, but as a block // - dynamic component resolves to plain element, but as a block
// - block creation disables its own tracking, accidentally causing the // - block creation disables its own tracking, accidentally causing the
// slot content (called during the block node creation) to be missed // slot content (called during the block node creation) to be missed
test('element block should track normalized slot children', () => { test('element block should track normalized slot children', () => {

View File

@ -14,7 +14,7 @@ import { VNodeProps } from './vnode'
// defineComponent is a utility that is primarily used for type inference // defineComponent is a utility that is primarily used for type inference
// when declaring components. Type inference is provided in the component // when declaring components. Type inference is provided in the component
// options (provided as the argument). The returned value has artifical types // options (provided as the argument). The returned value has artificial types
// for TSX / manual render function / IDE support. // for TSX / manual render function / IDE support.
// overload 1: direct setup function // overload 1: direct setup function
@ -83,7 +83,7 @@ export function defineComponent<
EE EE
> >
): { ): {
// array props technically doesn't place any contraints on props in TSX // array props technically doesn't place any constraints on props in TSX
new (): ComponentPublicInstance<VNodeProps, RawBindings, D, C, M, E> new (): ComponentPublicInstance<VNodeProps, RawBindings, D, C, M, E>
} & ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, E, EE> } & ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, E, EE>

View File

@ -48,7 +48,7 @@ type PropConstructor<T = any> =
| PropMethod<T> | PropMethod<T>
type PropMethod<T> = T extends (...args: any) => any // if is function with args type PropMethod<T> = T extends (...args: any) => any // if is function with args
? { new (): T; (): T; readonly proptotype: Function } // Create Function like contructor ? { new (): T; (): T; readonly proptotype: Function } // Create Function like constructor
: never : never
type RequiredKeys<T, MakeDefaultRequired> = { type RequiredKeys<T, MakeDefaultRequired> = {

View File

@ -75,7 +75,7 @@ export interface TransitionState {
export interface TransitionElement { export interface TransitionElement {
// in persisted mode (e.g. v-show), the same element is toggled, so the // in persisted mode (e.g. v-show), the same element is toggled, so the
// pending enter/leave callbacks may need to cancalled if the state is toggled // pending enter/leave callbacks may need to be cancelled if the state is toggled
// before it finishes. // before it finishes.
_enterCb?: PendingCallback _enterCb?: PendingCallback
_leaveCb?: PendingCallback _leaveCb?: PendingCallback

View File

@ -432,7 +432,7 @@ function createSuspenseBoundary(
handleSetupResult(instance, asyncSetupResult, false) handleSetupResult(instance, asyncSetupResult, false)
if (hydratedEl) { if (hydratedEl) {
// vnode may have been replaced if an update happened before the // vnode may have been replaced if an update happened before the
// async dep is reoslved. // async dep is resolved.
vnode.el = hydratedEl vnode.el = hydratedEl
} }
setupRenderEffect( setupRenderEffect(

View File

@ -1,6 +1,6 @@
import { render, h } from '@vue/runtime-dom' import { render, h } from '@vue/runtime-dom'
describe('customimized built-in elements support', () => { describe('customized built-in elements support', () => {
let createElement: jest.SpyInstance let createElement: jest.SpyInstance
afterEach(() => { afterEach(() => {
createElement.mockRestore() createElement.mockRestore()

View File

@ -114,7 +114,7 @@ describe('vModel', () => {
await nextTick() await nextTick()
expect(spy1).toHaveBeenCalledWith('foo') expect(spy1).toHaveBeenCalledWith('foo')
// udpate listener // update listener
toggle.value = false toggle.value = false
await nextTick() await nextTick()

View File

@ -16,7 +16,7 @@ export function patchAttr(
} }
} else { } else {
// note we are only checking boolean attributes that don't have a // note we are only checking boolean attributes that don't have a
// correspoding dom prop of the same name here. // corresponding dom prop of the same name here.
const isBoolean = isSpecialBooleanAttr(key) const isBoolean = isSpecialBooleanAttr(key)
if (value == null || (isBoolean && value === false)) { if (value == null || (isBoolean && value === false)) {
el.removeAttribute(key) el.removeAttribute(key)

View File

@ -370,7 +370,7 @@ describe('ssr: renderToString', () => {
test('async components', async () => { test('async components', async () => {
const Child = { const Child = {
// should wait for resovled render context from setup() // should wait for resolved render context from setup()
async setup() { async setup() {
return { return {
msg: 'hello' msg: 'hello'

View File

@ -61,7 +61,7 @@ describe('ssr: renderAttrs', () => {
).toBe(` foo="false"`) // non boolean should render `false` as is ).toBe(` foo="false"`) // non boolean should render `false` as is
}) })
test('ingore non-renderable values', () => { test('ignore non-renderable values', () => {
expect( expect(
ssrRenderAttrs({ ssrRenderAttrs({
foo: {}, foo: {},

View File

@ -68,7 +68,7 @@ export const enum PatchFlags {
// Special flags are negative integers. They are never matched against using // Special flags are negative integers. They are never matched against using
// bitwise operators (bitwise matching should only happen in branches where // bitwise operators (bitwise matching should only happen in branches where
// patchFlag > 0), and are mutually exclusive. When checking for a speical // patchFlag > 0), and are mutually exclusive. When checking for a special
// flag, simply check patchFlag === FLAG. // flag, simply check patchFlag === FLAG.
// Indicates a hoisted static vnode. This is a hint for hydration to skip // Indicates a hoisted static vnode. This is a hint for hydration to skip

View File

@ -3,7 +3,7 @@
// the renderer and compiler implementations. // the renderer and compiler implementations.
// Related files: // Related files:
// - runtime-core/src/renderer.ts // - runtime-core/src/renderer.ts
// - compiler-core/src/transoforms/transformElement.ts // - compiler-core/src/transforms/transformElement.ts
import { render, h, ref, nextTick } from '../src' import { render, h, ref, nextTick } from '../src'