mirror of
https://github.com/hanzoai/postcss.git
synced 2026-09-24 17:01:56 +00:00
PostCSS aims for byte-to-byte equal output, but the stringifier dropped a
leading byte order mark: `parse('a{}').toString()` returned `a{}`. The
BOM is already detected (`Input#hasBOM`) but was never re-emitted, so the
`bom.css` round-trip test had to be skipped.
Emit the BOM in `Stringifier#root` when the source had one, and re-enable the
previously skipped test.
19 lines
364 B
TypeScript
Executable File
19 lines
364 B
TypeScript
Executable File
import { eachTest } from 'postcss-parser-tests'
|
|
import { test } from 'uvu'
|
|
import { is } from 'uvu/assert'
|
|
|
|
import { parse, stringify } from '../lib/postcss.js'
|
|
|
|
eachTest((name, css) => {
|
|
test(`stringifies ${name}`, () => {
|
|
let root = parse(css)
|
|
let result = ''
|
|
stringify(root, i => {
|
|
result += i
|
|
})
|
|
is(result, css)
|
|
})
|
|
})
|
|
|
|
test.run()
|