@@ -192,15 +192,6 @@ export function main() {
|
||||
]);
|
||||
});
|
||||
|
||||
it('should report missing name after <', () => {
|
||||
expect(tokenizeAndHumanizeErrors('<'))
|
||||
.toEqual([[HtmlTokenType.TAG_OPEN_START, 'Unexpected character "EOF"', '0:1']]);
|
||||
});
|
||||
|
||||
it('should report missing >', () => {
|
||||
expect(tokenizeAndHumanizeErrors('<name'))
|
||||
.toEqual([[HtmlTokenType.TAG_OPEN_START, 'Unexpected character "EOF"', '0:5']]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('attributes', () => {
|
||||
@@ -335,20 +326,6 @@ export function main() {
|
||||
]);
|
||||
});
|
||||
|
||||
it('should report missing value after =', () => {
|
||||
expect(tokenizeAndHumanizeErrors('<name a='))
|
||||
.toEqual([[HtmlTokenType.ATTR_VALUE, 'Unexpected character "EOF"', '0:8']]);
|
||||
});
|
||||
|
||||
it('should report missing end quote for \'', () => {
|
||||
expect(tokenizeAndHumanizeErrors('<name a=\''))
|
||||
.toEqual([[HtmlTokenType.ATTR_VALUE, 'Unexpected character "EOF"', '0:9']]);
|
||||
});
|
||||
|
||||
it('should report missing end quote for "', () => {
|
||||
expect(tokenizeAndHumanizeErrors('<name a="'))
|
||||
.toEqual([[HtmlTokenType.ATTR_VALUE, 'Unexpected character "EOF"', '0:9']]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('closing tags', () => {
|
||||
@@ -448,6 +425,36 @@ export function main() {
|
||||
expect(tokenizeAndHumanizeSourceSpans('a'))
|
||||
.toEqual([[HtmlTokenType.TEXT, 'a'], [HtmlTokenType.EOF, '']]);
|
||||
});
|
||||
|
||||
it('should allow "<" in text nodes', () => {
|
||||
expect(tokenizeAndHumanizeParts('{{ a < b ? c : d }}'))
|
||||
.toEqual([[HtmlTokenType.TEXT, '{{ a < b ? c : d }}'], [HtmlTokenType.EOF]]);
|
||||
|
||||
expect(tokenizeAndHumanizeSourceSpans('<p>a<b</p>'))
|
||||
.toEqual([
|
||||
[HtmlTokenType.TAG_OPEN_START, '<p'],
|
||||
[HtmlTokenType.TAG_OPEN_END, '>'],
|
||||
[HtmlTokenType.TEXT, 'a<b'],
|
||||
[HtmlTokenType.TAG_CLOSE, '</p>'],
|
||||
[HtmlTokenType.EOF, ''],
|
||||
]);
|
||||
});
|
||||
|
||||
// TODO(vicb): make the lexer aware of Angular expressions
|
||||
// see https://github.com/angular/angular/issues/5679
|
||||
it('should parse valid start tag in interpolation', () => {
|
||||
expect(tokenizeAndHumanizeParts('{{ a <b && c > d }}'))
|
||||
.toEqual([
|
||||
[HtmlTokenType.TEXT, '{{ a '],
|
||||
[HtmlTokenType.TAG_OPEN_START, null, 'b'],
|
||||
[HtmlTokenType.ATTR_NAME, null, '&&'],
|
||||
[HtmlTokenType.ATTR_NAME, null, 'c'],
|
||||
[HtmlTokenType.TAG_OPEN_END],
|
||||
[HtmlTokenType.TEXT, ' d }}'],
|
||||
[HtmlTokenType.EOF]
|
||||
]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('raw text', () => {
|
||||
|
||||
Reference in New Issue
Block a user