Skip to content

Commit

Permalink
Merge pull request #1495 from 43081j/fix-root
Browse files Browse the repository at this point in the history
remove root assignment in stringifier
  • Loading branch information
ai committed Dec 29, 2020
2 parents ec11e19 + c8d18e6 commit b48a75e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/stringifier.js
Expand Up @@ -38,7 +38,6 @@ class Stringifier {
}

root (node) {
this.root = node
this.body(node)
if (node.raws.after) this.builder(node.raws.after)
}
Expand Down
9 changes: 9 additions & 0 deletions test/stringifier.test.js
Expand Up @@ -163,3 +163,12 @@ it('uses optional raws.indent', () => {
rule.append({ prop: 'color', value: 'black' })
expect(rule.toString()).toEqual('a {\n color: black\n}')
})

it('handles nested roots', () => {
let root = new Root()
let subRoot = new Root()
subRoot.append(new AtRule({ name: 'foo' }))
root.append(subRoot)

expect(root.toString()).toEqual('@foo')
})

0 comments on commit b48a75e

Please sign in to comment.