Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ let nested = (opts = {}) => {
)

if (child.name === rootRuleName) {
copyDeclarations = true
unwrapped = true
atruleChilds(rule, child, true, child[ROOT_RULE_MERGE_SEL])
after = breakOut(child, after)
Expand Down
14 changes: 14 additions & 0 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ test('at-root short hand', () => {
run('a { & {} @at-root b { } }', 'a {} b {}')
})

test('keeps declarations after at-root shorthand in source order', () => {
run(
'a { color: red; @at-root a { color: blue; } color: green; }',
'a { color: red; } a { color: blue; } a { color: green; }'
)
})

test('keeps declarations after an at-root block in source order', () => {
run(
'a { color: red; @at-root { a { color: blue; } } color: green; }',
'a { color: red; } a { color: blue; } a { color: green; }'
)
})

test('hoists multiple at-roots', () => {
run(
`a {
Expand Down
Loading