From 2662c01199684950b6abd561adeaca6f7647bcb7 Mon Sep 17 00:00:00 2001 From: Erik Lieben Date: Sun, 7 May 2017 14:41:40 +0200 Subject: [PATCH] feat(syntax): tokenize capture event binding --- syntaxes/html.json | 2 +- test/syntax.html/invoke.test.ts | 41 ++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/syntaxes/html.json b/syntaxes/html.json index 38a57a85..120ebbcf 100644 --- a/syntaxes/html.json +++ b/syntaxes/html.json @@ -257,7 +257,7 @@ } }, "tag-aurelia-attribute-with-invoke-attribute": { - "match": "(?=\\s)[^=](([a-zA-Z0-9:-]+)(\\.)(trigger|delegate|call))", + "match": "(?=\\s)[^=](([a-zA-Z0-9:-]+)(\\.)(trigger|delegate|call|capture))", "captures": { "2": { "name": "entity.other.attribute-name.html" diff --git a/test/syntax.html/invoke.test.ts b/test/syntax.html/invoke.test.ts index 038f287d..cc0e3409 100644 --- a/test/syntax.html/invoke.test.ts +++ b/test/syntax.html/invoke.test.ts @@ -31,46 +31,61 @@ describe('The Aurelia HTML syntax invoke attributes', () => { }); - it('must not tokenize attribute body that contains click.trigger keyword', () => { + it('must tokenize delegate attribute with scope "invoke.attribute.html.au"', () => { - // arrange- - let scope = 'meta.tag.block.any.html'; + // arrange + let scope = 'invoke.attribute.html.au'; // act - let lineToken = tokenizeLine('
'); + let lineToken = tokenizeLine('
'); // assert - let token = getTokenOnCharRange(lineToken, 17, 30); + let token = getTokenOnCharRange(lineToken, 11, 19); assert.isOk(hasScope(token.scopes, scope)); }); - it('must not tokenize invokes in attribute body with scope "invoke.attribute.html.au"', () => { + it('must tokenize capture attribute with scope "invoke.attribute.html.au"', () => { // arrange - let scope = 'meta.tag.inline.any.html'; + let scope = 'invoke.attribute.html.au'; // act - let lineToken = tokenizeLine(''); + let lineToken = tokenizeLine('
'); // assert - let token = getTokenOnCharRange(lineToken, 6, 29); + let token = getTokenOnCharRange(lineToken, 11, 18); + assert.isOk(hasScope(token.scopes, scope)); + + }); + + it('must not tokenize attribute body that contains click.trigger keyword', () => { + + // arrange- + let scope = 'meta.tag.block.any.html'; + + // act + let lineToken = tokenizeLine('
'); + + // assert + let token = getTokenOnCharRange(lineToken, 17, 30); assert.isOk(hasScope(token.scopes, scope)); }); - it('must tokenize delegate attribute with scope "invoke.attribute.html.au"', () => { + it('must not tokenize invokes in attribute body with scope "invoke.attribute.html.au"', () => { // arrange - let scope = 'invoke.attribute.html.au'; + let scope = 'meta.tag.inline.any.html'; // act - let lineToken = tokenizeLine('