Home / File/ static-style-parser.spec.ts — vue Source File

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.

File typescript 1 imports

Entity Profile

Dependency Diagram

graph LR
  690469f3_7fbe_6672_b91f_2739ad11cded["static-style-parser.spec.ts"]
  472b16b5_ed73_6ace_4ab4_82bfb52955ec["style"]
  690469f3_7fbe_6672_b91f_2739ad11cded --> 472b16b5_ed73_6ace_4ab4_82bfb52955ec
  style 690469f3_7fbe_6672_b91f_2739ad11cded 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

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