parser.spec.ts — vue Source File
Architecture documentation for parser.spec.ts, a typescript file in the vue codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9cd2a64b_6d44_5bc7_76fe_14b5f32483c3["parser.spec.ts"] 71c23c60_e463_32f9_8a85_8e36e7f91fd7["index"] 9cd2a64b_6d44_5bc7_76fe_14b5f32483c3 --> 71c23c60_e463_32f9_8a85_8e36e7f91fd7 09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"] 9cd2a64b_6d44_5bc7_76fe_14b5f32483c3 --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b b0b6bd3d_bce8_b3b0_ce33_925aad47348a["options"] 9cd2a64b_6d44_5bc7_76fe_14b5f32483c3 --> b0b6bd3d_bce8_b3b0_ce33_925aad47348a 1ec7e50f_8f20_0656_28f0_45cecc26cf74["env"] 9cd2a64b_6d44_5bc7_76fe_14b5f32483c3 --> 1ec7e50f_8f20_0656_28f0_45cecc26cf74 style 9cd2a64b_6d44_5bc7_76fe_14b5f32483c3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { parse } from 'compiler/parser/index'
import { extend } from 'shared/util'
import { baseOptions } from 'web/compiler/options'
import { isIE, isEdge } from 'core/util/env'
describe('parser', () => {
it('simple element', () => {
const ast = parse('<h1>hello world</h1>', baseOptions)
expect(ast.tag).toBe('h1')
expect(ast.plain).toBe(true)
expect(ast.children[0].text).toBe('hello world')
})
it('interpolation in element', () => {
const ast = parse('<h1>{{msg}}</h1>', baseOptions)
expect(ast.tag).toBe('h1')
expect(ast.plain).toBe(true)
expect(ast.children[0].expression).toBe('_s(msg)')
})
it('child elements', () => {
const ast = parse('<ul><li>hello world</li></ul>', baseOptions)
expect(ast.tag).toBe('ul')
expect(ast.plain).toBe(true)
expect(ast.children[0].tag).toBe('li')
expect(ast.children[0].plain).toBe(true)
expect(ast.children[0].children[0].text).toBe('hello world')
expect(ast.children[0].parent).toBe(ast)
})
it('unary element', () => {
const ast = parse('<hr>', baseOptions)
expect(ast.tag).toBe('hr')
expect(ast.plain).toBe(true)
expect(ast.children.length).toBe(0)
})
it('svg element', () => {
const ast = parse('<svg><text>hello world</text></svg>', baseOptions)
expect(ast.tag).toBe('svg')
expect(ast.ns).toBe('svg')
expect(ast.plain).toBe(true)
expect(ast.children[0].tag).toBe('text')
expect(ast.children[0].children[0].text).toBe('hello world')
expect(ast.children[0].parent).toBe(ast)
})
it('camelCase element', () => {
const ast = parse(
'<MyComponent><p>hello world</p></MyComponent>',
baseOptions
)
expect(ast.tag).toBe('MyComponent')
expect(ast.plain).toBe(true)
expect(ast.children[0].tag).toBe('p')
expect(ast.children[0].plain).toBe(true)
expect(ast.children[0].children[0].text).toBe('hello world')
expect(ast.children[0].parent).toBe(ast)
})
// ... (1090 more lines)
Dependencies
- env
- index
- options
- util
Source
Frequently Asked Questions
What does parser.spec.ts do?
parser.spec.ts is a source file in the vue codebase, written in typescript.
What does parser.spec.ts depend on?
parser.spec.ts imports 4 module(s): env, index, options, util.
Where is parser.spec.ts in the architecture?
parser.spec.ts is located at test/unit/modules/compiler/parser.spec.ts (directory: test/unit/modules/compiler).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free