Skip to content
Merged
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
26 changes: 26 additions & 0 deletions src/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2241,6 +2241,32 @@ describe('Core Nodes', () => {
expect(fn.name).toBe('function')
expect(fn.has_block).toBe(true)
})

test('multiple @function rules with result: descriptor are all parsed (#187)', () => {
// Regression test: @function blocks with result: descriptor caused subsequent
// @function rules to be skipped (every other rule was silently dropped)
let source =
'@function --a() { result: red; }\n@function --b() { result: blue; }\n@function --c() { result: green; }'
let root = parse(source)

expect(root.children.length).toBe(3)

let [a, b, c] = root.children
expect(a.type).toBe(AT_RULE)
expect(a.name).toBe('function')
expect(b.type).toBe(AT_RULE)
expect(b.name).toBe('function')
expect(c.type).toBe(AT_RULE)
expect(c.name).toBe('function')

// Verify each function's block contains exactly one declaration
expect(a.block!.children.length).toBe(1)
expect(a.block!.first_child!.property).toBe('result')
expect(b.block!.children.length).toBe(1)
expect(b.block!.first_child!.property).toBe('result')
expect(c.block!.children.length).toBe(1)
expect(c.block!.first_child!.property).toBe('result')
})
})

describe('@nest at-rule', () => {
Expand Down
Loading