assets.spec.ts — vue Source File
Architecture documentation for assets.spec.ts, a typescript file in the vue codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d20db13a_f612_700b_4dad_9d0808d281d5["assets.spec.ts"] db9e7bef_009d_3918_6e7d_543a36a38d75["vue"] d20db13a_f612_700b_4dad_9d0808d281d5 --> db9e7bef_009d_3918_6e7d_543a36a38d75 style d20db13a_f612_700b_4dad_9d0808d281d5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
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)
expect(Test[type]('test')).toBe(def)
// extended registration should not pollute global
expect(Vue.options[type + 's'].test).toBeUndefined()
})
})
describe('Vue.component', () => {
it('should register a component', () => {
Vue.component('foo', {
template: '<span>foo</span>'
})
Vue.component('bar', {
template: '<span>bar</span>'
})
const vm = new Vue({
template: '<div><foo></foo><bar></bar></div>'
}).$mount()
expect(vm.$el.innerHTML).toBe('<span>foo</span><span>bar</span>')
// unregister them
delete Vue.options.components.foo
delete Vue.options.components.bar
})
})
it('component on extended constructor', () => {
const def = { a: 1 }
Test.component('test', def)
const component = Test.options.components.test
expect(typeof component).toBe('function')
expect(component.super).toBe(Vue)
expect(component.options.a).toBe(1)
expect(component.options.name).toBe('test')
expect(Test.component('test')).toBe(component)
// already extended
Test.component('test2', component)
expect(Test.component('test2')).toBe(component)
// extended registration should not pollute global
expect(Vue.options.components.test).toBeUndefined()
})
// #4434
it('local registration should take priority regardless of naming convention', () => {
Vue.component('x-foo', {
template: '<span>global</span>'
})
const vm = new Vue({
components: {
xFoo: {
template: '<span>local</span>'
}
},
template: '<div><x-foo></x-foo></div>'
}).$mount()
expect(vm.$el.textContent).toBe('local')
delete Vue.options.components['x-foo']
})
})
Dependencies
- vue
Source
Frequently Asked Questions
What does assets.spec.ts do?
assets.spec.ts is a source file in the vue codebase, written in typescript.
What does assets.spec.ts depend on?
assets.spec.ts imports 1 module(s): vue.
Where is assets.spec.ts in the architecture?
assets.spec.ts is located at test/unit/features/global-api/assets.spec.ts (directory: test/unit/features/global-api).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free