Skip to content

Commit

Permalink
fix(highlight): containerless, compile-spy, and view-spy regex add fo…
Browse files Browse the repository at this point in the history
…ward lookahead for ' ' or '>', resolves #35
  • Loading branch information
Erik Lieben committed Feb 8, 2017
1 parent 16ca230 commit 8735a7a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 5 deletions.
6 changes: 3 additions & 3 deletions syntaxes/html.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,23 +373,23 @@
}
},
"tag-aurelia-containerless-attribute" : {
"match": "(containerless)( |>)",
"match": "(containerless)(?= |>)",
"captures": {
"1": {
"name": "containerless.attribute.html.au"
}
}
},
"tag-aurelia-compile-spy-attribute" : {
"match": "(compile-spy)( |>)",
"match": "(compile-spy)(?= |>)",
"captures": {
"1": {
"name": "compile-spy.attribute.html.au"
}
}
},
"tag-aurelia-view-spy-attribute" : {
"match": "(view-spy)( |>)",
"match": "(view-spy)(?= |>)",
"captures": {
"1": {
"name": "view-spy.attribute.html.au"
Expand Down
20 changes: 18 additions & 2 deletions test/syntax.html/compile-spy.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from 'chai';
import { getTokenOnCharRange, hasScope, tokenizeLine } from './test.utils';
import { getTokenOnCharRange, hasScope, tokenizeLine, writeOut } from './test.utils';

describe('The Aurelia HTML syntax compile-spy attribute', () => {

Expand Down Expand Up @@ -47,7 +47,7 @@ describe('The Aurelia HTML syntax compile-spy attribute', () => {

});

it('must not tokenize foo-containerles="" attribute', () => {
it('must not tokenize foo-compile-spy="" attribute', () => {

// arrange
let scope = 'compile-spy.attribute.html.au';
Expand Down Expand Up @@ -91,4 +91,20 @@ describe('The Aurelia HTML syntax compile-spy attribute', () => {
assert.isNotOk(hasScope(token.scopes, scope));

});

it('must tokenize compile-spy attribute', () => {

// arrange
let scope = 'compile-spy.attribute.html.au';

// act
let template = '<template compile-spy></template>';
let lineToken = tokenizeLine(template);

// assert
let token = getTokenOnCharRange(lineToken, 10, 21);
assert.isDefined(token);
assert.isOk(hasScope(token.scopes, scope));

});
});
17 changes: 17 additions & 0 deletions test/syntax.html/containerless.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,21 @@ describe('The Aurelia HTML syntax containerles attribute', () => {
assert.isNotOk(hasScope(token.scopes, scope));

});

it('must tokenize containerless attribute', () => {

// arrange
let scope = 'containerless.attribute.html.au';

// act
let template = '<template containerless></template>';
let lineToken = tokenizeLine(template);

// assert
let token = getTokenOnCharRange(lineToken, 10, 23);
assert.isDefined(token);
assert.isOk(hasScope(token.scopes, scope));

});

});
16 changes: 16 additions & 0 deletions test/syntax.html/view-spy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,20 @@ describe('The Aurelia HTML syntax view-spy attribute', () => {
assert.isNotOk(hasScope(token.scopes, scope));

});

it('must tokenize compile-spy attribute', () => {

// arrange
let scope = 'view-spy.attribute.html.au';

// act
let template = '<template view-spy></template>';
let lineToken = tokenizeLine(template);

// assert
let token = getTokenOnCharRange(lineToken, 10, 18);
assert.isDefined(token);
assert.isOk(hasScope(token.scopes, scope));

});
});

0 comments on commit 8735a7a

Please sign in to comment.