-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(syntax): tokenize replace-part with replace-part.attribute.html.au
- Loading branch information
1 parent
52e4447
commit ffab125
Showing
2 changed files
with
200 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
import { assert } from 'chai'; | ||
import { getTokenOnCharRange, hasScope, tokenizeLine, writeOut } from './test.utils'; | ||
|
||
describe('The Aurelia HTML syntax replace-part attribute', () => { | ||
|
||
it(`must tokenize (replace-part)="item-template" attribute with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replace-part.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template replace-part="item-template">'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 22); | ||
assert.isOk(hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must tokenize (replace-part)='item-template' attribute with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replace-part.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template replace-part=\'item-template\'>'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 22); | ||
assert.isOk(hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize (replace-part) attribute with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replace-part.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template replace-part>'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 22); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize class="replace-part" attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<div class="replace-part">'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 12, 24); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize class='replace-part' attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<div class=\'replace-part\'>'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 12, 24); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize (somereplace-part)="item-template" attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template somereplace-part="item-template">'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 26); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize (somereplace-part)='item-template' attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template somereplace-part=\'item-template\'>'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 26); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize (replace-partsome)="item-template" attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template replace-partsome="item-template">'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 26); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize (replace-partsome)='item-template' attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template replace-partsome=\'item-template\'>'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 26); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize (replace-part-some)="item-template" attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template replace-part-some="item-template">'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 27); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize (replace-part-some)='item-template' attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template replace-part-some=\'item-template\'>'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 27); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize (some-replace-part)="item-template" attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template some-replace-part="item-template">'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 27); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
it(`must not tokenize (some-replace-part)='item-template' attribute body with scope "replace-part.attribute.html.au"`, () => { | ||
|
||
// arrange | ||
let scope = 'replaceable.attribute.html.au'; | ||
|
||
// act | ||
let lineToken = tokenizeLine('<template some-replace-part=\'item-template\'>'); | ||
|
||
// assert | ||
let token = getTokenOnCharRange(lineToken, 10, 27); | ||
assert.isOk(!hasScope(token.scopes, scope)); | ||
|
||
}); | ||
|
||
}); |