repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/apiSetup.ts | src/v3/apiSetup.ts | import { Component } from 'types/component'
import { PropOptions } from 'types/options'
import { popTarget, pushTarget } from '../core/observer/dep'
import { def, invokeWithErrorHandling, isReserved, warn } from '../core/util'
import VNode from '../core/vdom/vnode'
import {
bind,
emptyObject,
isArray,
isFunctio... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/sfc-helpers/useCssVars.ts | src/v3/sfc-helpers/useCssVars.ts | import { watchPostEffect } from '../'
import { inBrowser, warn } from 'core/util'
import { currentInstance } from '../currentInstance'
/**
* Runtime helper for SFC's CSS variable injection feature.
* @private
*/
export function useCssVars(
getter: (
vm: Record<string, any>,
setupProxy: Record<string, any>... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/sfc-helpers/useCssModule.ts | src/v3/sfc-helpers/useCssModule.ts | import { emptyObject, warn } from '../../core/util'
import { currentInstance } from '../currentInstance'
export function useCssModule(name = '$style'): Record<string, string> {
/* istanbul ignore else */
if (!__GLOBAL__) {
if (!currentInstance) {
__DEV__ && warn(`useCssModule must be called inside setup(... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/reactivity/readonly.ts | src/v3/reactivity/readonly.ts | import { def, warn, isPlainObject, isArray } from 'core/util'
import {
isCollectionType,
isReadonly,
isShallow,
ReactiveFlags,
UnwrapNestedRefs
} from './reactive'
import { isRef, Ref, RefFlag } from './ref'
type Primitive = string | number | boolean | bigint | symbol | undefined | null
type Builtin = Primit... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/reactivity/reactive.ts | src/v3/reactivity/reactive.ts | import { observe, Observer } from 'core/observer'
import {
def,
isArray,
isPrimitive,
warn,
toRawType,
isServerRendering
} from 'core/util'
import type { Ref, UnwrapRefSimple, RawSymbol } from './ref'
export const enum ReactiveFlags {
SKIP = '__v_skip',
IS_READONLY = '__v_isReadonly',
IS_SHALLOW = '_... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/reactivity/effect.ts | src/v3/reactivity/effect.ts | import Watcher from 'core/observer/watcher'
import { noop } from 'shared/util'
import { currentInstance } from '../currentInstance'
// export type EffectScheduler = (...args: any[]) => any
/**
* @internal since we are not exposing this in Vue 2, it's used only for
* internal testing.
*/
export function effect(fn: ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/reactivity/operations.ts | src/v3/reactivity/operations.ts | // using literal strings instead of numbers so that it's easier to inspect
// debugger events
export const enum TrackOpTypes {
GET = 'get',
TOUCH = 'touch'
}
export const enum TriggerOpTypes {
SET = 'set',
ADD = 'add',
DELETE = 'delete',
ARRAY_MUTATION = 'array mutation'
}
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/reactivity/ref.ts | src/v3/reactivity/ref.ts | import { defineReactive } from 'core/observer/index'
import {
isReactive,
ReactiveFlags,
type ShallowReactiveMarker
} from './reactive'
import type { IfAny } from 'types/utils'
import Dep from 'core/observer/dep'
import { warn, isArray, def, isServerRendering } from 'core/util'
import { TrackOpTypes, TriggerOpTyp... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/reactivity/effectScope.ts | src/v3/reactivity/effectScope.ts | import Watcher from 'core/observer/watcher'
import { warn } from 'core/util'
export let activeEffectScope: EffectScope | undefined
export class EffectScope {
/**
* @internal
*/
active = true
/**
* @internal
*/
effects: Watcher[] = []
/**
* @internal
*/
cleanups: (() => void)[] = []
/**... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/v3/reactivity/computed.ts | src/v3/reactivity/computed.ts | import { isServerRendering, noop, warn, def, isFunction } from 'core/util'
import { Ref, RefFlag } from './ref'
import Watcher from 'core/observer/watcher'
import Dep from 'core/observer/dep'
import { currentInstance } from '../currentInstance'
import { ReactiveFlags } from './reactive'
import { TrackOpTypes } from './... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/helpers.ts | src/compiler/helpers.ts | import { emptyObject } from 'shared/util'
import { ASTElement, ASTModifiers } from 'types/compiler'
import { parseFilters } from './parser/filter-parser'
type Range = { start?: number; end?: number }
/* eslint-disable no-unused-vars */
export function baseWarn(msg: string, range?: Range) {
console.error(`[Vue compi... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/create-compiler.ts | src/compiler/create-compiler.ts | import { extend } from 'shared/util'
import { CompilerOptions, CompiledResult, WarningMessage } from 'types/compiler'
import { detectErrors } from './error-detector'
import { createCompileToFunctionFn } from './to-function'
export function createCompilerCreator(baseCompile: Function): Function {
return function crea... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/codeframe.ts | src/compiler/codeframe.ts | const range = 2
export function generateCodeFrame(
source: string,
start: number = 0,
end: number = source.length
): string {
const lines = source.split(/\r?\n/)
let count = 0
const res: string[] = []
for (let i = 0; i < lines.length; i++) {
count += lines[i].length + 1
if (count >= start) {
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/to-function.ts | src/compiler/to-function.ts | import { noop, extend } from 'shared/util'
import { warn as baseWarn, tip } from 'core/util/debug'
import { generateCodeFrame } from './codeframe'
import type { Component } from 'types/component'
import { CompilerOptions } from 'types/compiler'
type CompiledFunctionResult = {
render: Function
staticRenderFns: Arra... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/index.ts | src/compiler/index.ts | import { parse } from './parser/index'
import { optimize } from './optimizer'
import { generate } from './codegen/index'
import { createCompilerCreator } from './create-compiler'
import { CompilerOptions, CompiledResult } from 'types/compiler'
// `createCompilerCreator` allows creating compilers that use alternative
/... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/error-detector.ts | src/compiler/error-detector.ts | import { ASTElement, ASTNode } from 'types/compiler'
import { dirRE, onRE } from './parser/index'
type Range = { start?: number; end?: number }
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
const prohibitedKeywordRE = new RegExp(
'\\b' +
(
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/optimizer.ts | src/compiler/optimizer.ts | import { makeMap, isBuiltInTag, cached, no } from 'shared/util'
import { ASTElement, CompilerOptions, ASTNode } from 'types/compiler'
let isStaticKey
let isPlatformReservedTag
const genStaticKeysCached = cached(genStaticKeys)
/**
* Goal of the optimizer: walk the generated template AST tree
* and detect sub-trees ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/codegen/index.ts | src/compiler/codegen/index.ts | import { genHandlers } from './events'
import baseDirectives from '../directives/index'
import { camelize, no, extend, capitalize } from 'shared/util'
import { baseWarn, pluckModuleFunction } from '../helpers'
import { emptySlotScopeToken } from '../parser/index'
import {
ASTAttr,
ASTDirective,
ASTElement,
ASTE... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/codegen/events.ts | src/compiler/codegen/events.ts | import { ASTElementHandler, ASTElementHandlers } from 'types/compiler'
const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/
const fnInvokeRE = /\([^)]*?\);*$/
const simplePathRE =
/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/
// KeyboardEvent.key... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/directives/on.ts | src/compiler/directives/on.ts | import { warn } from 'core/util/index'
import { ASTDirective, ASTElement } from 'types/compiler'
export default function on(el: ASTElement, dir: ASTDirective) {
if (__DEV__ && dir.modifiers) {
warn(`v-on without argument does not support modifiers.`)
}
el.wrapListeners = (code: string) => `_g(${code},${dir.v... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/directives/model.ts | src/compiler/directives/model.ts | import { ASTElement, ASTModifiers } from 'types/compiler'
/**
* Cross-platform code generation for component v-model
*/
export function genComponentModel(
el: ASTElement,
value: string,
modifiers: ASTModifiers | null
): void {
const { number, trim } = modifiers || {}
const baseValueExpression = '$$v'
le... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/directives/bind.ts | src/compiler/directives/bind.ts | import { ASTDirective, ASTElement } from 'types/compiler'
export default function bind(el: ASTElement, dir: ASTDirective) {
el.wrapData = (code: string) => {
return `_b(${code},'${el.tag}',${dir.value},${
dir.modifiers && dir.modifiers.prop ? 'true' : 'false'
}${dir.modifiers && dir.modifiers.sync ? ',... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/directives/index.ts | src/compiler/directives/index.ts | import on from './on'
import bind from './bind'
import { noop } from 'shared/util'
export default {
on,
bind,
cloak: noop
}
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/parser/html-parser.ts | src/compiler/parser/html-parser.ts | /**
* Not type-checking this file because it's mostly vendor code.
*/
/*!
* HTML Parser By John Resig (ejohn.org)
* Modified by Juriy "kangax" Zaytsev
* Original code by Erik Arvidsson (MPL-1.1 OR Apache-2.0 OR GPL-2.0-or-later)
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*/
import { makeMap, no... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/parser/filter-parser.ts | src/compiler/parser/filter-parser.ts | const validDivisionCharRE = /[\w).+\-_$\]]/
export function parseFilters(exp: string): string {
let inSingle = false
let inDouble = false
let inTemplateString = false
let inRegex = false
let curly = 0
let square = 0
let paren = 0
let lastFilterIndex = 0
let c, prev, i, expression, filters
for (i =... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/parser/text-parser.ts | src/compiler/parser/text-parser.ts | import { cached } from 'shared/util'
import { parseFilters } from './filter-parser'
const defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g
const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
const buildRegex = cached(delimiters => {
const open = delimiters[0].replace(regexEscapeRE, '\\$&')
const close = delimiters[1].replace... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/parser/entity-decoder.ts | src/compiler/parser/entity-decoder.ts | let decoder
export default {
decode(html: string): string {
decoder = decoder || document.createElement('div')
decoder.innerHTML = html
return decoder.textContent
}
}
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/src/compiler/parser/index.ts | src/compiler/parser/index.ts | import he from 'he'
import { parseHTML } from './html-parser'
import { parseText } from './text-parser'
import { parseFilters } from './filter-parser'
import { genAssignmentCode } from '../directives/model'
import { extend, cached, no, camelize, hyphenate } from 'shared/util'
import { isIE, isEdge, isServerRendering } ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/test-env.d.ts | test/test-env.d.ts | interface Chainer {
then(next: Function): this
thenWaitFor(n: number | Function): this
end(endFn: Function): void
}
declare function waitForUpdate(cb: Function): Chainer
declare function createTextVNode(arg?: string): any
declare function triggerEvent(
target: Element,
event: string,
process?: (e: any) =... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/vitest.setup.ts | test/vitest.setup.ts | process.env.NEW_SLOT_SYNTAX = 'true'
import './helpers/shim-done'
import './helpers/to-have-warned'
import './helpers/classlist'
import { waitForUpdate } from './helpers/wait-for-update'
import { triggerEvent } from './helpers/trigger-event'
import { createTextVNode } from './helpers/vdom'
global.waitForUpdate = wai... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/helpers/vdom.ts | test/helpers/vdom.ts | import VNode from 'core/vdom/vnode'
export function createTextVNode(text) {
return new VNode(undefined, undefined, undefined, text)
}
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/helpers/shim-done.ts | test/helpers/shim-done.ts | // wrap tests to support test('foo', done => {...}) interface
const _test = test
const wait = (): [() => void, Promise<void>] => {
let done
const p = new Promise<void>((resolve, reject) => {
done = resolve
done.fail = reject
})
return [done, p]
}
const shimmed =
((global as any).it =
(global as an... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/helpers/classlist.ts | test/helpers/classlist.ts | expect.extend({
toHaveClass(el: Element, cls: string) {
const pass = el.classList
? el.classList.contains(cls)
: (el.getAttribute('class') || '').split(/\s+/g).indexOf(cls) > -1
return {
pass,
message: () =>
`Expected element${pass ? ' ' : ' not '}to have class ${cls}`
}
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/helpers/trigger-event.ts | test/helpers/trigger-event.ts | export function triggerEvent(target, event, process) {
const e = document.createEvent('HTMLEvents')
e.initEvent(event, true, true)
if (event === 'click') {
// @ts-expect-error Button is readonly
;(e as MouseEvent).button = 0
}
if (process) process(e)
target.dispatchEvent(e)
}
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/helpers/to-have-warned.ts | test/helpers/to-have-warned.ts | import { SpyInstance } from 'vitest'
expect.extend({
toHaveBeenWarned(received: string) {
asserted.add(received)
const passed = warn.mock.calls.some(args =>
String(args[0]).includes(received)
)
if (passed) {
return {
pass: true,
message: () => `expected "${received}" not t... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/helpers/test-object-option.ts | test/helpers/test-object-option.ts | import Vue from 'vue'
export default function testObjectOption(name) {
it(`Options ${name}: should warn non object value`, () => {
const options = {}
options[name] = () => {}
new Vue(options)
expect(`Invalid value for option "${name}"`).toHaveBeenWarned()
})
it(`Options ${name}: should not warn ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/helpers/wait-for-update.ts | test/helpers/wait-for-update.ts | import Vue from 'vue'
// helper for async assertions.
// Use like this:
//
// vm.a = 123
// waitForUpdate(() => {
// expect(vm.$el.textContent).toBe('123')
// vm.a = 234
// })
// .then(() => {
// // more assertions...
// })
// .then(done)
interface Job extends Function {
wait?: boolean
fail?: (e: any) => vo... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/basic-ssr.spec.ts | test/e2e/basic-ssr.spec.ts | // @vitest-environment node
import path from 'path'
import { E2E_TIMEOUT, setupPuppeteer } from './e2eUtils'
describe('basic-ssr', () => {
const { page, text } = setupPuppeteer()
test(
'should work',
async () => {
await page().goto(`file://${path.resolve(__dirname, `basic-ssr.html`)}`)
expect(... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/todomvc.spec.ts | test/e2e/todomvc.spec.ts | import { setupPuppeteer, getExampleUrl, E2E_TIMEOUT } from './e2eUtils'
describe('e2e: todomvc', () => {
const {
page,
click,
isVisible,
count,
text,
value,
isChecked,
isFocused,
classList,
enterValue,
clearValue
} = setupPuppeteer()
async function removeItemAt(n: num... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/e2eUtils.ts | test/e2e/e2eUtils.ts | import path from 'path'
import puppeteer from 'puppeteer'
export function getExampleUrl(
name: string,
apiType: 'classic' | 'composition'
) {
const file = apiType === 'composition' ? `${name}.html` : `${name}/index.html`
return `file://${path.resolve(
__dirname,
`../../examples/${apiType}/${file}`
)}... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/commits.mock.ts | test/e2e/commits.mock.ts | export default {
main: [
{
sha: '0948d999f2fddf9f90991956493f976273c5da1f',
node_id:
'MDY6Q29tbWl0MTE3MzAzNDI6MDk0OGQ5OTlmMmZkZGY5ZjkwOTkxOTU2NDkzZjk3NjI3M2M1ZGExZg==',
commit: {
author: {
name: 'Evan You',
email: 'yyx990803@gmail.com',
date: '2017-1... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/svg.spec.ts | test/e2e/svg.spec.ts | import { setupPuppeteer, getExampleUrl, E2E_TIMEOUT } from './e2eUtils'
declare const globalStats: {
label: string
value: number
}[]
declare function valueToPoint(
value: number,
index: number,
total: number
): {
x: number
y: number
}
describe('e2e: svg', () => {
const { page, click, count, setValue,... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/markdown.spec.ts | test/e2e/markdown.spec.ts | import {
setupPuppeteer,
expectByPolling,
getExampleUrl,
E2E_TIMEOUT
} from './e2eUtils'
describe('e2e: markdown', () => {
const { page, isVisible, value, html } = setupPuppeteer()
async function testMarkdown(apiType: 'classic' | 'composition') {
await page().goto(getExampleUrl('markdown', apiType))
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/commits.spec.ts | test/e2e/commits.spec.ts | // @vitest-environment node
import { setupPuppeteer, getExampleUrl, E2E_TIMEOUT } from './e2eUtils'
import mocks from './commits.mock'
describe('e2e: commits', () => {
const { page, click, count, text, isChecked } = setupPuppeteer()
async function testCommits(apiType: 'classic' | 'composition') {
// intercept... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/tree.spec.ts | test/e2e/tree.spec.ts | import { setupPuppeteer, getExampleUrl, E2E_TIMEOUT } from './e2eUtils'
describe('e2e: tree', () => {
const { page, click, count, text, childrenCount, isVisible } =
setupPuppeteer()
async function testTree(apiType: 'classic' | 'composition') {
await page().goto(getExampleUrl('tree', apiType))
expect(a... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/grid.spec.ts | test/e2e/grid.spec.ts | import { setupPuppeteer, getExampleUrl, E2E_TIMEOUT } from './e2eUtils'
interface TableData {
name: string
power: number
}
describe('e2e: grid', () => {
const { page, click, text, count, typeValue, clearValue } = setupPuppeteer()
const columns = ['name', 'power'] as const
async function assertTable(data: T... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/e2e/async-edge-cases.spec.ts | test/e2e/async-edge-cases.spec.ts | // @vitest-environment node
import path from 'path'
import { E2E_TIMEOUT, setupPuppeteer } from './e2eUtils'
describe('basic-ssr', () => {
const { page, text, click, isChecked } = setupPuppeteer()
test(
'should work',
async () => {
await page().goto(
`file://${path.resolve(__dirname, `async-... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/transition/transition-with-keep-alive.spec.ts | test/transition/transition-with-keep-alive.spec.ts | import Vue from 'vue'
import { injectStyles, waitForUpdate, nextFrame } from './helpers'
describe('Transition w/ KeepAlive', () => {
const { duration, buffer } = injectStyles()
let components, one, two, el
beforeEach(() => {
one = {
template: '<div>one</div>',
created: jasmine.createSpy(),
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/transition/transition.spec.ts | test/transition/transition.spec.ts | import Vue from 'vue'
import { injectStyles, waitForUpdate, nextFrame } from './helpers'
describe('Transition basic', () => {
const { duration, buffer } = injectStyles() as {
duration: number
buffer: number
}
const explicitDuration = duration * 2
let el
beforeEach(() => {
el = document.createEle... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | true |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/transition/transition-mode.spec.ts | test/transition/transition-mode.spec.ts | import Vue from 'vue'
import { injectStyles, waitForUpdate, nextFrame } from './helpers'
describe('Transition mode', () => {
const { duration, buffer } = injectStyles()
const components = {
one: { template: '<div>one</div>' },
two: { template: '<div>two</div>' }
}
let el
beforeEach(() => {
el = ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/transition/helpers.ts | test/transition/helpers.ts | export { waitForUpdate } from '../helpers/wait-for-update'
export { nextFrame } from 'web/runtime/transition-util'
// toHaveBeenWarned() matcher
function noop() {}
if (typeof console === 'undefined') {
// @ts-ignore
window.console = {
warn: noop,
error: noop
}
}
// avoid info messages during test
conso... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/transition/transition-group.spec.ts | test/transition/transition-group.spec.ts | import Vue from 'vue'
import { injectStyles, waitForUpdate, nextFrame } from './helpers'
describe('Transition group', () => {
const { duration, buffer } = injectStyles()
let el
beforeEach(() => {
el = document.createElement('div')
document.body.appendChild(el)
})
function createBasicVM(useIs?, appe... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/debug.spec.ts | test/unit/features/debug.spec.ts | import Vue from 'vue'
import { formatComponentName, warn } from 'core/util/debug'
describe('Debug utilities', () => {
it('properly format component names', () => {
const vm = new Vue()
expect(formatComponentName(vm)).toBe('<Root>')
vm.$root = null
vm.$options.name = 'hello-there'
expect(formatCo... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/template-ref.spec.ts | test/unit/features/template-ref.spec.ts | import Vue from 'vue'
describe('ref', () => {
type TestShape = {
id: string
template: string
data?: any
components?: any
}
type ComponentShape = {
test: TestShape
test2: TestShape
test3: TestShape
}
const components: ComponentShape = {
test: {
id: 'test',
template:... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/error-handling.spec.ts | test/unit/features/error-handling.spec.ts | import Vue from 'vue'
const components = createErrorTestComponents()
describe('Error handling', () => {
// hooks that prevents the component from rendering, but should not
// break parent component
;[
['data', 'data()'],
['render', 'render'],
['beforeCreate', 'beforeCreate hook'],
['created', 'c... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/filter/filter.spec.ts | test/unit/features/filter/filter.spec.ts | import Vue from 'vue'
import { parseFilters } from 'compiler/parser/filter-parser'
describe('Filters', () => {
it('basic usage', () => {
const vm = new Vue({
template: '<div>{{ msg | upper }}</div>',
data: {
msg: 'hi'
},
filters: {
upper: v => v.toUpperCase()
}
}... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/props.spec.ts | test/unit/features/options/props.spec.ts | import Vue from 'vue'
import { hasSymbol } from 'core/util/env'
import testObjectOption from '../../../helpers/test-object-option'
import { ref } from 'v3'
describe('Options props', () => {
testObjectOption('props')
it('array syntax', done => {
const vm = new Vue({
data: {
b: 'bar'
},
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/comments.spec.ts | test/unit/features/options/comments.spec.ts | import Vue from 'vue'
describe('Comments', () => {
it('comments should be kept', () => {
const vm = new Vue({
comments: true,
data() {
return {
foo: 1
}
},
template:
'<div><span>node1</span><!--comment1-->{{foo}}<!--comment2--></div>'
}).$mount()
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/errorCaptured.spec.ts | test/unit/features/options/errorCaptured.spec.ts | import Vue from 'vue'
describe('Options errorCaptured', () => {
let globalSpy
beforeEach(() => {
globalSpy = Vue.config.errorHandler = vi.fn()
})
afterEach(() => {
Vue.config.errorHandler = undefined
})
it('should capture error from child component', () => {
const spy = vi.fn()
let chil... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/delimiters.spec.ts | test/unit/features/options/delimiters.spec.ts | import Vue from 'vue'
describe('Delimiters', () => {
it('default delimiters should work', () => {
const vm = new Vue({
data: {
a: 1
},
template: '<div>{{ a }}</div>'
}).$mount()
expect(vm.$el.textContent).toEqual('1')
})
it('custom delimiters should work', () => {
const... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/components.spec.ts | test/unit/features/options/components.spec.ts | import Vue from 'vue'
import { UA } from 'core/util/env'
import testObjectOption from '../../../helpers/test-object-option'
describe('Options components', () => {
testObjectOption('components')
it('should accept plain object', () => {
const vm = new Vue({
template: '<test></test>',
components: {
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/mixins.spec.ts | test/unit/features/options/mixins.spec.ts | import Vue from 'vue'
import { mergeOptions } from 'core/util/index'
describe('Options mixins', () => {
it('vm should have options from mixin', () => {
const mixin = {
directives: {
c: {}
},
methods: {
a: function () {}
}
}
const vm = new Vue({
mixins: [mixi... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/parent.spec.ts | test/unit/features/options/parent.spec.ts | import Vue from 'vue'
describe('Options parent', () => {
it('should work', () => {
const parent = new Vue({
render() {}
}).$mount()
const child = new Vue({
parent: parent,
render() {}
}).$mount()
// this option is straight-forward
// it should register 'parent' as a $paren... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/methods.spec.ts | test/unit/features/options/methods.spec.ts | import Vue from 'vue'
import testObjectOption from '../../../helpers/test-object-option'
describe('Options methods', () => {
testObjectOption('methods')
it('should have correct context', () => {
const vm = new Vue({
data: {
a: 1
},
methods: {
plus() {
this.a++
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/el.spec.ts | test/unit/features/options/el.spec.ts | import Vue from 'vue'
describe('Options el', () => {
it('basic usage', () => {
const el = document.createElement('div')
el.innerHTML = '<span>{{message}}</span>'
const vm = new Vue({
el,
data: { message: 'hello world' }
})
expect(vm.$el.tagName).toBe('DIV')
expect(vm.$el.textConte... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/functional.spec.ts | test/unit/features/options/functional.spec.ts | import Vue from 'vue'
import { createEmptyVNode } from 'core/vdom/vnode'
describe('Options functional', () => {
it('should work', done => {
const vm = new Vue({
data: { test: 'foo' },
template: '<div><wrap :msg="test">bar</wrap></div>',
components: {
wrap: {
functional: true,
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/renderError.spec.ts | test/unit/features/options/renderError.spec.ts | import Vue from 'vue'
describe('Options renderError', () => {
it('should be used on render errors', done => {
Vue.config.errorHandler = () => {}
const vm = new Vue({
data: {
ok: true
},
render(h) {
if (this.ok) {
return h('div', 'ok')
} else {
thr... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/template.spec.ts | test/unit/features/options/template.spec.ts | import Vue from 'vue'
describe('Options template', () => {
let el
beforeEach(() => {
el = document.createElement('script')
el.type = 'x-template'
el.id = 'app'
el.innerHTML = '<p>{{message}}</p>'
document.body.appendChild(el)
})
afterEach(() => {
document.body.removeChild(el)
})
i... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/lifecycle.spec.ts | test/unit/features/options/lifecycle.spec.ts | import Vue from 'vue'
describe('Options lifecycle hooks', () => {
let spy
beforeEach(() => {
spy = vi.fn()
})
describe('beforeCreate', () => {
it('should allow modifying options', () => {
const vm = new Vue({
data: {
a: 1
},
beforeCreate() {
spy()
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/extends.spec.ts | test/unit/features/options/extends.spec.ts | import Vue from 'vue'
import { nativeWatch } from 'core/util/env'
describe('Options extends', () => {
it('should work on objects', () => {
const A = {
data() {
return { a: 1 }
}
}
const B = {
extends: A,
data() {
return { b: 2 }
}
}
const vm = new Vue... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/directives.spec.ts | test/unit/features/options/directives.spec.ts | import { SpyInstanceFn } from 'vitest'
import Vue from 'vue'
describe('Options directives', () => {
it('basic usage', done => {
const bindSpy = vi.fn()
const insertedSpy = vi.fn()
const updateSpy = vi.fn()
const componentUpdatedSpy = vi.fn()
const unbindSpy = vi.fn()
const assertContext = (e... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/name.spec.ts | test/unit/features/options/name.spec.ts | import Vue from 'vue'
describe('Options name', () => {
it('should contain itself in self components', () => {
const vm = Vue.extend({
name: 'SuperVue'
})
expect(vm.options.components['SuperVue']).toEqual(vm)
})
it('should warn when incorrect name given', () => {
Vue.extend({
name: '... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/computed.spec.ts | test/unit/features/options/computed.spec.ts | import Vue from 'vue'
import testObjectOption from '../../../helpers/test-object-option'
describe('Options computed', () => {
testObjectOption('computed')
it('basic usage', done => {
const vm = new Vue({
template: '<div>{{ b }}</div>',
data: {
a: 1
},
computed: {
b() {
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/inject.spec.ts | test/unit/features/options/inject.spec.ts | import Vue from 'vue'
import { Observer } from 'core/observer/index'
import { isNative, isObject, hasOwn, nextTick } from 'core/util/index'
import testObjectOption from '../../../helpers/test-object-option'
describe('Options provide/inject', () => {
testObjectOption('inject')
let injected
const injectedComp = {... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/render.spec.ts | test/unit/features/options/render.spec.ts | import Vue from 'vue'
describe('Options render', () => {
it('basic usage', () => {
const vm = new Vue({
render(h) {
const children: any[] = []
for (let i = 0; i < this.items.length; i++) {
children.push(h('li', { staticClass: 'task' }, [this.items[i].name]))
}
retu... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/inheritAttrs.spec.ts | test/unit/features/options/inheritAttrs.spec.ts | import Vue from 'vue'
describe('Options inheritAttrs', () => {
it('should work', done => {
const vm = new Vue({
template: `<foo :id="foo"/>`,
data: { foo: 'foo' },
components: {
foo: {
inheritAttrs: false,
template: `<div>foo</div>`
}
}
}).$mount()
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/data.spec.ts | test/unit/features/options/data.spec.ts | import Vue from 'vue'
describe('Options data', () => {
it('should proxy and be reactive', done => {
const data = { msg: 'foo' }
const vm = new Vue({
data,
template: '<div>{{ msg }}</div>'
}).$mount()
expect(vm.$data).toEqual({ msg: 'foo' })
expect(vm.$data).toBe(data)
data.msg = '... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/propsData.spec.ts | test/unit/features/options/propsData.spec.ts | import Vue from 'vue'
describe('Options propsData', () => {
it('should work', done => {
const A = Vue.extend({
props: ['a'],
template: '<div>{{ a }}</div>'
})
const vm = new A({
propsData: {
a: 123
}
}).$mount()
expect(vm.a).toBe(123)
expect(vm.$el.textContent)... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/watch.spec.ts | test/unit/features/options/watch.spec.ts | import Vue from 'vue'
import testObjectOption from '../../../helpers/test-object-option'
describe('Options watch', () => {
let spy
beforeEach(() => {
spy = vi.fn()
})
testObjectOption('watch')
it('basic usage', done => {
const vm = new Vue({
data: {
a: 1
},
watch: {
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/options/_scopeId.spec.ts | test/unit/features/options/_scopeId.spec.ts | import Vue from 'vue'
describe('Options _scopeId', () => {
it('should add scopeId attributes', () => {
const vm = new Vue({
_scopeId: 'foo',
template: '<div><p><span></span></p></div>'
}).$mount()
expect(vm.$el.hasAttribute('foo')).toBe(true)
expect(vm.$el.children[0].hasAttribute('foo'))... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/global-api/observable.spec.ts | test/unit/features/global-api/observable.spec.ts | import Vue from 'vue'
describe('Global API: observable', () => {
it('should work', done => {
const state = Vue.observable({
count: 0
})
const app = new Vue({
render(h) {
return h('div', [
h('span', state.count),
h(
'button',
{
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/global-api/extend.spec.ts | test/unit/features/global-api/extend.spec.ts | import Vue from 'vue'
describe('Global API: extend', () => {
it('should correctly merge options', () => {
const Test = Vue.extend({
name: 'test',
a: 1,
b: 2
})
expect(Test.options.a).toBe(1)
expect(Test.options.b).toBe(2)
expect(Test.super).toBe(Vue)
const t = new Test({
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/global-api/use.spec.ts | test/unit/features/global-api/use.spec.ts | import Vue from 'vue'
describe('Global API: use', () => {
const def = {}
const options = {}
const pluginStub = {
install: (Vue, opts) => {
Vue.directive('plugin-test', def)
expect(opts).toBe(options)
}
}
it('should apply Object plugin', () => {
Vue.use(pluginStub, options)
expect... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/global-api/set-delete.spec.ts | test/unit/features/global-api/set-delete.spec.ts | import Vue from 'vue'
describe('Global API: set/delete', () => {
describe('Vue.set', () => {
it('should update a vue object', done => {
const vm = new Vue({
template: '<div>{{x}}</div>',
data: { x: 1 }
}).$mount()
expect(vm.$el.innerHTML).toBe('1')
Vue.set(vm, 'x', 2)
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/global-api/compile.spec.ts | test/unit/features/global-api/compile.spec.ts | import Vue from 'vue'
describe('Global API: compile', () => {
it('should compile render functions', () => {
const res = Vue.compile('<div><span>{{ msg }}</span></div>')
const vm = new Vue({
data: {
msg: 'hello'
},
render: res.render,
staticRenderFns: res.staticRenderFns
})... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/global-api/assets.spec.ts | test/unit/features/global-api/assets.spec.ts | import Vue from 'vue'
describe('Global API: assets', () => {
const Test = Vue.extend()
it('directive / filters', () => {
const assets = ['directive', 'filter']
assets.forEach(function (type) {
const def = {}
Test[type]('test', def)
expect(Test.options[type + 's'].test).toBe(def)
ex... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/global-api/mixin.spec.ts | test/unit/features/global-api/mixin.spec.ts | import Vue from 'vue'
describe('Global API: mixin', () => {
let options
beforeEach(() => {
options = Vue.options
})
afterEach(() => {
Vue.options = options
})
it('should work', () => {
const spy = vi.fn()
Vue.mixin({
created() {
spy(this.$options.myOption)
}
})
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/global-api/config.spec.ts | test/unit/features/global-api/config.spec.ts | import Vue from 'vue'
import { warn } from 'core/util/debug'
describe('Global config', () => {
it('should warn replacing config object', () => {
const originalConfig = Vue.config
Vue.config = {}
expect(Vue.config).toBe(originalConfig)
expect('Do not replace the Vue.config object').toHaveBeenWarned()
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/component/component-async.spec.ts | test/unit/features/component/component-async.spec.ts | import Vue from 'vue'
describe('Component async', () => {
const oldSetTimeout = setTimeout
const oldClearTimeout = clearTimeout
// will contain pending timeouts set during the test iteration
// will contain the id of the timeout as the key, and the millisecond timeout as the value
// this helps to identify ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/component/component.spec.ts | test/unit/features/component/component.spec.ts | import Vue from 'vue'
describe('Component', () => {
it('static', () => {
const vm = new Vue({
template: '<test></test>',
components: {
test: {
data() {
return { a: 123 }
},
template: '<span>{{a}}</span>'
}
}
}).$mount()
expect(vm... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/component/component-slot.spec.ts | test/unit/features/component/component-slot.spec.ts | import Vue from 'vue'
describe('Component slot', () => {
let vm, child
function mount(options) {
vm = new Vue({
data: {
msg: 'parent message'
},
template: `<div><test>${options.parentContent || ''}</test></div>`,
components: {
test: {
template: options.childTem... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/component/component-keep-alive.spec.ts | test/unit/features/component/component-keep-alive.spec.ts | import Vue from 'vue'
describe('Component keep-alive', () => {
let components, one, two, el
beforeEach(() => {
one = {
template: '<div>one</div>',
created: vi.fn(),
mounted: vi.fn(),
activated: vi.fn(),
deactivated: vi.fn(),
destroyed: vi.fn()
}
two = {
templat... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/component/component-scoped-slot.spec.ts | test/unit/features/component/component-scoped-slot.spec.ts | import Vue from 'vue'
describe('Component scoped slot', () => {
it('default slot', done => {
const vm = new Vue({
template: `
<test ref="test">
<template slot-scope="props">
<span>{{ props.msg }}</span>
</template>
</test>
`,
components: {
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | true |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/directives/model-text.spec.ts | test/unit/features/directives/model-text.spec.ts | import Vue from 'vue'
import { isIE9, isIE, isAndroid } from 'core/util/env'
describe('Directive v-model text', () => {
it('should update value both ways', done => {
const vm = new Vue({
data: {
test: 'b'
},
template: '<input v-model="test">'
}).$mount()
expect(vm.$el.value).toB... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/directives/model-component.spec.ts | test/unit/features/directives/model-component.spec.ts | import Vue from 'vue'
describe('Directive v-model component', () => {
it('should work', done => {
const vm = new Vue({
data: {
msg: 'hello'
},
template: `
<div>
<p>{{ msg }}</p>
<test v-model="msg"></test>
</div>
`,
components: {
t... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/directives/if.spec.ts | test/unit/features/directives/if.spec.ts | import Vue from 'vue'
describe('Directive v-if', () => {
it('should check if value is truthy', () => {
const vm = new Vue({
template: '<div><span v-if="foo">hello</span></div>',
data: { foo: true }
}).$mount()
expect(vm.$el.innerHTML).toBe('<span>hello</span>')
})
it('should check if val... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/directives/cloak.spec.ts | test/unit/features/directives/cloak.spec.ts | import Vue from 'vue'
describe('Directive v-cloak', () => {
it('should be removed after compile', () => {
const el = document.createElement('div')
el.setAttribute('v-cloak', '')
const vm = new Vue({ el })
expect(vm.$el.hasAttribute('v-cloak')).toBe(false)
})
})
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/directives/bind.spec.ts | test/unit/features/directives/bind.spec.ts | import Vue from 'vue'
describe('Directive v-bind', () => {
it('normal attr', done => {
const vm = new Vue({
template: '<div><span :test="foo">hello</span></div>',
data: { foo: 'ok' }
}).$mount()
expect(vm.$el.firstChild.getAttribute('test')).toBe('ok')
vm.foo = 'again'
waitForUpdate((... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/directives/text.spec.ts | test/unit/features/directives/text.spec.ts | import Vue from 'vue'
describe('Directive v-text', () => {
it('should render text', () => {
const vm = new Vue({
template: '<div v-text="a"></div>',
data: { a: 'hello' }
}).$mount()
expect(vm.$el.innerHTML).toBe('hello')
})
it('should encode html entities', () => {
const vm = new Vue... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/test/unit/features/directives/show.spec.ts | test/unit/features/directives/show.spec.ts | import Vue from 'vue'
describe('Directive v-show', () => {
it('should check show value is truthy', () => {
const vm = new Vue({
template: '<div><span v-show="foo">hello</span></div>',
data: { foo: true }
}).$mount()
expect(vm.$el.firstChild.style.display).toBe('')
})
it('should check sho... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.