Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit ee79471

Browse files
committed
add a test for ng-template
1 parent 646d835 commit ee79471

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec/grammar-spec.coffee

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,21 @@ describe 'directive grammar', ->
195195
expect(lines[0][15]).toEqual value: 'setImage(img)', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'meta.tag.template.angular']
196196
expect(lines[0][16]).toEqual value: '}}', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'meta.tag.template.angular', 'meta.tag.template.angular', 'punctuation.definition.block.end.angular']
197197
expect(lines[0][17]).toEqual value: '"', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'string.quoted.double.html.angular', 'punctuation.definition.string.end.html.angular']
198+
199+
describe 'angular ng-template', ->
200+
it 'tokenizes contents inside ng-template', ->
201+
lines = grammar.tokenizeLines '''
202+
<script type="text/ng-template" id="/tpl.html">
203+
<li>First name: {{firstname}}</li>
204+
</script>
205+
'''
206+
207+
expect(lines[1][1]).toEqual value: '<', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'punctuation.definition.tag.begin.html']
208+
expect(lines[1][2]).toEqual value: 'li', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'entity.name.tag.inline.any.html']
209+
expect(lines[1][3]).toEqual value: '>', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'punctuation.definition.tag.end.html']
210+
expect(lines[1][5]).toEqual value: '{{', scopes: ['text.html.angular', 'meta.tag.template.angular', 'punctuation.definition.block.begin.angular']
211+
expect(lines[1][6]).toEqual value: 'firstname', scopes: ['text.html.angular', 'meta.tag.template.angular']
212+
expect(lines[1][7]).toEqual value: '}}', scopes: ['text.html.angular', 'meta.tag.template.angular', 'punctuation.definition.block.end.angular']
213+
expect(lines[1][8]).toEqual value: '</', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'punctuation.definition.tag.begin.html']
214+
expect(lines[1][9]).toEqual value: 'li', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'entity.name.tag.inline.any.html']
215+
expect(lines[1][10]).toEqual value: '>', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'punctuation.definition.tag.end.html']

0 commit comments

Comments
 (0)