Skip to content

Commit 23505f3

Browse files
Test annotation cleanup with CRLF and CR line endings
1 parent 46d9fca commit 23505f3

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎test/map.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,28 @@ test('clears all annotations with empty processor', () => {
764764
is(result.css, 'a{}\nb{}\n/* c */')
765765
})
766766

767+
for (let [name, eol] of [
768+
['LF', '\n'],
769+
['CRLF', '\r\n'],
770+
['CR', '\r']
771+
]) {
772+
test(`clears complete ${name} line breaks before an annotation at EOF`, () => {
773+
let css = `a{}${eol}/*# sourceMappingURL=a.map */`
774+
let result = postcss().process(css, { from: undefined })
775+
776+
is(result.css, 'a{}')
777+
})
778+
779+
test(`clears complete ${name} line breaks before multiple annotations`, () => {
780+
let css =
781+
`a{}${eol}/*# sourceMappingURL=a.map */${eol}` +
782+
`b{}${eol}${eol}/*# sourceMappingURL=b.map */${eol}/* c */`
783+
let result = postcss().process(css, { from: undefined })
784+
785+
is(result.css, `a{}${eol}b{}${eol}/* c */`)
786+
})
787+
}
788+
767789
test('clears annotations before unclosed one with empty processor', () => {
768790
let css =
769791
'a{}\n/*# sourceMappingURL=a.map */\nb{}\n/*# sourceMappingURL=b.map'

0 commit comments

Comments
 (0)