diff --git a/packages/@glimmer/syntax/lib/parser/tokenizer-event-handlers.ts b/packages/@glimmer/syntax/lib/parser/tokenizer-event-handlers.ts index 69bc492a16..568b616f41 100644 --- a/packages/@glimmer/syntax/lib/parser/tokenizer-event-handlers.ts +++ b/packages/@glimmer/syntax/lib/parser/tokenizer-event-handlers.ts @@ -421,6 +421,7 @@ export class TokenizerEventHandlers extends HandlebarsNodeVisitors { ); } else { state = { state: 'AfterEndPipe' }; + this.tokenizer.consume(); } } else if (next === '>' || next === '/') { throw generateSyntaxError( diff --git a/packages/@glimmer/syntax/test/parser-node-test.ts b/packages/@glimmer/syntax/test/parser-node-test.ts index 5bd0ba57b8..db63f42616 100644 --- a/packages/@glimmer/syntax/test/parser-node-test.ts +++ b/packages/@glimmer/syntax/test/parser-node-test.ts @@ -316,6 +316,25 @@ test('block with block params', () => { ); }); +test('block with block params edge case: extra spaces', () => { + let t = `{{#foo as | bar bat baz |}}{{bar}} {{bat}} {{baz}}{{/foo}}`; + + astEqual( + t, + b.template([ + b.block( + b.path('foo'), + null, + null, + b.blockItself( + [b.mustache('bar'), b.text(' '), b.mustache('bat'), b.text(' '), b.mustache('baz')], + ['bar', 'bat', 'baz'] + ) + ), + ]) + ); +}); + test('block with block params edge case: multiline', () => { let t = `{{#foo as |bar bat @@ -389,6 +408,21 @@ test('element with block params', () => { ); }); +test('element with block params edge case: extra spaces', () => { + let t = `{{bar}} {{bat}} {{baz}}`; + + astEqual( + t, + b.template([ + element( + 'Foo', + ['as', b.var('bar'), b.var('bat'), b.var('baz')], + ['body', b.mustache('bar'), b.text(' '), b.mustache('bat'), b.text(' '), b.mustache('baz')] + ), + ]) + ); +}); + test('element with block params edge case: multiline', () => { let t = `