diff --git a/lib/pegjs/html/tag-string.pegjs b/lib/pegjs/html/tag-string.pegjs index ae9fd44..c4af46a 100644 --- a/lib/pegjs/html/tag-string.pegjs +++ b/lib/pegjs/html/tag-string.pegjs @@ -4,4 +4,4 @@ start = tagString tagString = c:$tagChar+ -tagChar = [_a-zA-Z0-9-] / nonSeparatorColon +tagChar = [_a-zA-Z0-9-] / nonSeparatorColon / '@' diff --git a/tests/integration/glimmer-component-test.js b/tests/integration/glimmer-component-test.js index 31829b9..0d25d99 100644 --- a/tests/integration/glimmer-component-test.js +++ b/tests/integration/glimmer-component-test.js @@ -93,3 +93,17 @@ test('recursive nesting part 2', function(){ ' p Hello'); compilesTo(emblem, '

Hello

'); }); + +test('named block support', function() { + var emblem = w( + '% x-modal', + ' % @header as |@title|', + ' |Header #{title}', + ' % @body', + ' |Body', + ' % @footer', + ' |Footer' + ) + + compilesTo(emblem, '<@header as |@title|>Header {{title}}<@body>Body<@footer>Footer'); +}); diff --git a/tests/integration/mustaches-test.js b/tests/integration/mustaches-test.js index 87037cd..10a08b1 100644 --- a/tests/integration/mustaches-test.js +++ b/tests/integration/mustaches-test.js @@ -529,3 +529,27 @@ test('mustache with else if and complex statements', function() { compilesTo(emblem, '{{#if foo}}

Hi!

{{else if (eq 1 (and-or a=b showHidden=(eq 1 2)))}}

Wow what was that?

{{/if}}'); }); + +test('named block support', function() { + var emblem = w( + '= x-modal', + ' % @header as |@title|', + ' |Header #{title}', + ' % @body', + ' |Body', + ' % @footer', + ' |Footer' + ) + + compilesTo(emblem, '{{#x-modal}}<@header as |@title|>Header {{title}}<@body>Body<@footer>Footer{{/x-modal}}'); +}); + +test('named block with block param', function() { + var emblem = w( + '= x-layout as |@widget|', + ' = @widget as |a b c|', + ' |Hi.' + ) + + compilesTo(emblem, '{{#x-layout as |@widget|}}{{#@widget as |a b c|}}Hi.{{/@widget}}{{/x-layout}}'); +});