static-style-parser.spec.ts — vue Source File
Architecture documentation for static-style-parser.spec.ts, a typescript file in the vue codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 08df16df_5f71_fb57_ceaf_116c63bdff90["static-style-parser.spec.ts"] 40b0afbe_a3c8_9769_c890_cf9c2266939c["style"] 08df16df_5f71_fb57_ceaf_116c63bdff90 --> 40b0afbe_a3c8_9769_c890_cf9c2266939c style 08df16df_5f71_fb57_ceaf_116c63bdff90 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { parseStyleText } from 'web/util/style'
const base64ImgUrl =
'url("data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==")'
const logoUrl = 'url(https://vuejs.org/images/logo.png)'
it('should parse normal static style', () => {
const staticStyle = `font-size: 12px;background: ${logoUrl};color:red`
const res = parseStyleText(staticStyle)
expect(res.background).toBe(logoUrl)
expect(res.color).toBe('red')
expect(res['font-size']).toBe('12px')
})
it('should parse base64 background', () => {
const staticStyle = `background: ${base64ImgUrl}`
const res = parseStyleText(staticStyle)
expect(res.background).toBe(base64ImgUrl)
})
it('should parse multiple background images ', () => {
let staticStyle = `background: ${logoUrl}, ${logoUrl};`
let res = parseStyleText(staticStyle)
expect(res.background).toBe(`${logoUrl}, ${logoUrl}`)
staticStyle = `background: ${base64ImgUrl}, ${base64ImgUrl}`
res = parseStyleText(staticStyle)
expect(res.background).toBe(`${base64ImgUrl}, ${base64ImgUrl}`)
})
it('should parse other images ', () => {
let staticStyle = `shape-outside: ${logoUrl}`
let res = parseStyleText(staticStyle)
expect(res['shape-outside']).toBe(logoUrl)
staticStyle = `list-style-image: ${logoUrl}`
res = parseStyleText(staticStyle)
expect(res['list-style-image']).toBe(logoUrl)
staticStyle = `border-image: ${logoUrl} 30 30 repeat`
res = parseStyleText(staticStyle)
expect(res['border-image']).toBe(`${logoUrl} 30 30 repeat`)
})
Dependencies
- style
Source
Frequently Asked Questions
What does static-style-parser.spec.ts do?
static-style-parser.spec.ts is a source file in the vue codebase, written in typescript.
What does static-style-parser.spec.ts depend on?
static-style-parser.spec.ts imports 1 module(s): style.
Where is static-style-parser.spec.ts in the architecture?
static-style-parser.spec.ts is located at test/unit/features/directives/static-style-parser.spec.ts (directory: test/unit/features/directives).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free