isPreTag: tag => tag === 'pre'
})
const elementAfterPre = ast.children[1] as ElementNode
- // should not affect the <span> and condense its whitepsace inside
+ // should not affect the <span> and condense its whitespace inside
expect((elementAfterPre.children[0] as TextNode).content).toBe(` foo bar`)
})
expect(root.components).toContain(`Foo`)
})
- test('resolve implcitly self-referencing component', () => {
+ test('resolve implicitly self-referencing component', () => {
const { root } = parseWithElementTransform(`<Example/>`, {
filename: `/foo/bar/Example.vue?vue&type=template`
})
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`the v-if/else-if/else branchs in Transition should ignore comments 1`] = `
+exports[`the v-if/else-if/else branches in Transition should ignore comments 1`] = `
"const _Vue = Vue
return function render(_ctx, _cache) {
})
})
-test('the v-if/else-if/else branchs in Transition should ignore comments', () => {
+test('the v-if/else-if/else branches in Transition should ignore comments', () => {
expect(
compile(`
<transition>
`)
// should generate working code
assertCode(content)
- // should anayze bindings
+ // should analyze bindings
expect(bindings).toStrictEqual({
foo: BindingTypes.PROPS,
bar: BindingTypes.SETUP_CONST,
assertCode(content)
})
- // #4340 interpolations in tempalte strings
+ // #4340 interpolations in template strings
test('js template string interpolations', () => {
const { content } = compile(`
<script setup lang="ts">
}
}
-function noramlizeExpression(exp: string) {
+function normalizeExpression(exp: string) {
exp = exp.trim()
if (
(exp[0] === `'` && exp[exp.length - 1] === `'`) ||
// ignore v-bind() in comments /* ... */
const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '')
while ((match = cssVarRE.exec(content))) {
- const variable = noramlizeExpression(match[1])
+ const variable = normalizeExpression(match[1])
if (!vars.includes(variable)) {
vars.push(variable)
}
// rewrite CSS variables
if (cssVarRE.test(decl.value)) {
decl.value = decl.value.replace(cssVarRE, (_, $1) => {
- return `var(--${genVarName(id, noramlizeExpression($1), isProd)})`
+ return `var(--${genVarName(id, normalizeExpression($1), isProd)})`
})
}
}
exports[`macro import alias and removal 1`] = `
"import { ref as _ref, toRef as _toRef } from 'vue'
-
+
let a = _ref(1)
const __$temp_1 = (useMouse()),
d = _toRef(__$temp_1, 'd', 1),
f = _toRef(__$temp_1, 'e', 2),
h = _toRef(__$temp_1, g)
- let __$temp_2 = (useSomthing(() => 1)),
+ let __$temp_2 = (useSomething(() => 1)),
foo = _toRef(__$temp_2, 'foo');
console.log(n.value, a.value, c.value, d.value, f.value, h.value, foo.value)
"
test('object destructure', () => {
const { code, rootRefs } = transform(`
let n = $ref(1), { a, b: c, d = 1, e: f = 2, [g]: h } = $(useFoo())
- let { foo } = $(useSomthing(() => 1));
+ let { foo } = $(useSomething(() => 1));
console.log(n, a, c, d, f, h, foo)
`)
expect(code).toMatch(`a = _toRef(__$temp_1, 'a')`)
counter.num = 6
expect(dummy).toBe(7)
- // nested scope should not be stoped
+ // nested scope should not be stopped
expect(doubled).toBe(12)
})
expect(spy).toHaveBeenCalledTimes(1)
})
- it('should derefence child scope from parent scope after stopping child scope (no memleaks)', () => {
+ it('should dereference child scope from parent scope after stopping child scope (no memleaks)', () => {
const parent = new EffectScope()
const child = parent.run(() => new EffectScope())!
expect(parent.scopes!.includes(child)).toBe(true)
expect(
'Set operation on key "_dirty" failed: target is readonly.'
).not.toHaveBeenWarned()
- // @ts-expect-error - non-existant property
+ // @ts-expect-error - non-existent property
rC.randomProperty = true
expect(
expect(isReadonly(rr.foo)).toBe(true)
})
- test('attemptingt to write plain value to a readonly ref nested in a reactive object should fail', () => {
+ test('attempting to write plain value to a readonly ref nested in a reactive object should fail', () => {
const r = ref(false)
const ror = readonly(r)
const obj = reactive({ ror })
cleanups: (() => void)[] = []
/**
- * only assinged by undetached scope
+ * only assigned by undetached scope
* @internal
*/
parent: EffectScope | undefined
await nextTick()
expect(deps.length).toBe(2)
- // switch before two resovles
+ // switch before two resolves
view.value = Three
await nextTick()
expect(deps.length).toBe(3)
await nextTick()
expect(deps.length).toBe(2)
- // switch back before two resovles
+ // switch back before two resolves
view.value = One
await nextTick()
expect(deps.length).toBe(2)
})
// unlike other lifecycle hooks, created/beforeCreate are called as part of
- // the options API initiualization process instead of by the renderer.
+ // the options API initialization process instead of by the renderer.
test('in created/beforeCreate hook', () => {
const err = new Error('foo')
const fn = jest.fn()
// since v-memo really is a compiler + runtime combo feature, we are performing
-// more of an itegration test here.
+// more of an integration test here.
import { ComponentOptions, createApp, nextTick } from 'vue'
describe('v-memo', () => {
// #3881
// root cause: fragment inside a compiled slot passed to component which
// programmatically invokes the slot. The entire slot should de-opt but
- // the fragment was incorretly put in optimized mode which causes it to skip
+ // the fragment was incorrectly put in optimized mode which causes it to skip
// updates for its inner components.
test('fragments inside programmatically invoked compiled slot should de-opt properly', async () => {
const Parent: FunctionalComponent = (_, { slots }) => slots.default!()
accessCache: null!,
renderCache: [],
- // local resovled assets
+ // local resolved assets
components: null,
directives: null,
*
* type-only, used to assist Mixin's type inference,
* typescript will try to simplify the inferred `Mixin` type,
- * with the `__differenciator`, typescript won't be able to combine different mixins,
- * because the `__differenciator` will be different
+ * with the `__differentiator`, typescript won't be able to combine different mixins,
+ * because the `__differentiator` will be different
*/
__differentiator?: keyof D | keyof C | keyof M
}
bar.selected = false
data.value = new Set([{ foo: 1 }, { bar: 1 }])
await nextTick()
- // whithout looseEqual, here is different from Array
+ // without looseEqual, here is different from Array
expect(foo.selected).toEqual(false)
expect(bar.selected).toEqual(false)
})
test('form attribute', () => {
const el = document.createElement('input')
patchProp(el, 'form', null, 'foo')
- // non existant element
+ // non existent element
expect(el.form).toBe(null)
expect(el.getAttribute('form')).toBe('foo')
// remove attribute
}
expect(toDisplayString(objWithToStringOverride)).toBe('override')
- const objWithNonInvokeableToString = {
+ const objWithNonInvokableToString = {
foo: 555,
toString: null
}
- expect(toDisplayString(objWithNonInvokeableToString)).toBe(
+ expect(toDisplayString(objWithNonInvokableToString)).toBe(
`{
"foo": 555,
"toString": null
| ID | Type | Description | Docs |
| ------------------ | ---- | ------------------------------------- | ---------------------------------------- |
-| TRANSITION_CLASSES | ⭘ | Transtion enter/leave classes changed | [link](https://v3-migration.vuejs.org/breaking-changes/transition.html) |
+| TRANSITION_CLASSES | ⭘ | Transition enter/leave classes changed | [link](https://v3-migration.vuejs.org/breaking-changes/transition.html) |
### Fully Compatible
ff: Function as PropType<(a: number, b: string) => { a: boolean }>,
// explicit type casting with constructor
ccc: Array as () => string[],
- // required + contructor type casting
+ // required + constructor type casting
ddd: {
type: Array as () => string[],
required: true
ff: Function as PropType<(a: number, b: string) => { a: boolean }>,
// explicit type casting with constructor
ccc: Array as () => string[],
- // required + contructor type casting
+ // required + constructor type casting
ddd: {
type: Array as () => string[],
required: true