edge-cases.spec.ts — vue Source File
Architecture documentation for edge-cases.spec.ts, a typescript file in the vue codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR af719072_e400_a1c0_7852_b3a8acd84b5f["edge-cases.spec.ts"] db9e7bef_009d_3918_6e7d_543a36a38d75["vue"] af719072_e400_a1c0_7852_b3a8acd84b5f --> db9e7bef_009d_3918_6e7d_543a36a38d75 ab8fc425_80ef_461f_288a_985447c26d02["constants"] af719072_e400_a1c0_7852_b3a8acd84b5f --> ab8fc425_80ef_461f_288a_985447c26d02 style af719072_e400_a1c0_7852_b3a8acd84b5f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import Vue from 'vue'
import { SSR_ATTR } from 'shared/constants'
describe('vdom patch: edge cases', () => {
// exposed by #3406
// When a static vnode is inside v-for, it's possible for the same vnode
// to be used in multiple places, and its element will be replaced. This
// causes patch errors when node ops depend on the vnode's element position.
it('should handle static vnodes by key', done => {
const vm = new Vue({
data: {
ok: true
},
template: `
<div>
<div v-for="i in 2">
<div v-if="ok">a</div><div>b</div><div v-if="!ok">c</div><div>d</div>
</div>
</div>
`
}).$mount()
expect(vm.$el.textContent).toBe('abdabd')
vm.ok = false
waitForUpdate(() => {
expect(vm.$el.textContent).toBe('bcdbcd')
}).then(done)
})
// exposed by #7705
// methods and function expressions with modifiers should return result instead of undefined
// skipped odd children[1,3, ...] because they are rendered as text nodes with undefined value
it("should return listener's result for method name and function expression with and w/o modifiers", done => {
const dummyEvt = { preventDefault: () => {} }
new Vue({
template: `
<div v-test>
<div @click="addFive"></div>
<div @click.prevent="addFive"></div>
<div @click="addFive($event, 5)"></div>
<div @click.prevent="addFive($event, 5)"></div>
</div>
`,
methods: {
addFive($event, toAdd = 0) {
return toAdd + 5
}
},
directives: {
test: {
bind(el, binding, vnode) {
waitForUpdate(() => {
expect(vnode.children[0].data.on.click()).toBe(5)
expect(vnode.children[2].data.on.click(dummyEvt)).toBe(5)
expect(vnode.children[4].data.on.click()).toBe(10)
expect(vnode.children[6].data.on.click(dummyEvt)).toBe(10)
}).then(done)
}
}
}
}).$mount()
// ... (449 more lines)
Dependencies
- constants
- vue
Source
Frequently Asked Questions
What does edge-cases.spec.ts do?
edge-cases.spec.ts is a source file in the vue codebase, written in typescript.
What does edge-cases.spec.ts depend on?
edge-cases.spec.ts imports 2 module(s): constants, vue.
Where is edge-cases.spec.ts in the architecture?
edge-cases.spec.ts is located at test/unit/modules/vdom/patch/edge-cases.spec.ts (directory: test/unit/modules/vdom/patch).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free