|
7 | 7 | */
|
8 | 8 |
|
9 | 9 | import {getHtmlTagDefinition} from '../../src/ml_parser/html_tags';
|
10 |
| -import {InterpolationConfig} from '../../src/ml_parser/interpolation_config'; |
11 | 10 | import * as lex from '../../src/ml_parser/lexer';
|
12 | 11 | import {ParseLocation, ParseSourceFile, ParseSourceSpan} from '../../src/parse_util';
|
13 | 12 |
|
@@ -378,6 +377,18 @@ import {ParseLocation, ParseSourceFile, ParseSourceSpan} from '../../src/parse_u
|
378 | 377 | ]);
|
379 | 378 | });
|
380 | 379 |
|
| 380 | + it('should report missing closing single quote', () => { |
| 381 | + expect(tokenizeAndHumanizeErrors('<t a=\'b>')).toEqual([ |
| 382 | + [lex.TokenType.ATTR_VALUE, 'Unexpected character "EOF"', '0:8'], |
| 383 | + ]); |
| 384 | + }); |
| 385 | + |
| 386 | + it('should report missing closing double quote', () => { |
| 387 | + expect(tokenizeAndHumanizeErrors('<t a="b>')).toEqual([ |
| 388 | + [lex.TokenType.ATTR_VALUE, 'Unexpected character "EOF"', '0:8'], |
| 389 | + ]); |
| 390 | + }); |
| 391 | + |
381 | 392 | });
|
382 | 393 |
|
383 | 394 | describe('closing tags', () => {
|
@@ -552,6 +563,31 @@ import {ParseLocation, ParseSourceFile, ParseSourceSpan} from '../../src/parse_u
|
552 | 563 | ]);
|
553 | 564 | });
|
554 | 565 |
|
| 566 | + it('should parse start tags quotes in place of an attribute name as text', () => { |
| 567 | + expect(tokenizeAndHumanizeParts('<t ">')).toEqual([ |
| 568 | + [lex.TokenType.TEXT, '<t ">'], |
| 569 | + [lex.TokenType.EOF], |
| 570 | + ]); |
| 571 | + |
| 572 | + expect(tokenizeAndHumanizeParts('<t \'>')).toEqual([ |
| 573 | + [lex.TokenType.TEXT, '<t \'>'], |
| 574 | + [lex.TokenType.EOF], |
| 575 | + ]); |
| 576 | + }); |
| 577 | + |
| 578 | + it('should parse start tags quotes in place of an attribute name (after a valid attribute) as text', |
| 579 | + () => { |
| 580 | + expect(tokenizeAndHumanizeParts('<t a="b" ">')).toEqual([ |
| 581 | + [lex.TokenType.TEXT, '<t a="b" ">'], |
| 582 | + [lex.TokenType.EOF], |
| 583 | + ]); |
| 584 | + |
| 585 | + expect(tokenizeAndHumanizeParts('<t a=\'b\' \'>')).toEqual([ |
| 586 | + [lex.TokenType.TEXT, '<t a=\'b\' \'>'], |
| 587 | + [lex.TokenType.EOF], |
| 588 | + ]); |
| 589 | + }); |
| 590 | + |
555 | 591 | it('should be able to escape {', () => {
|
556 | 592 | expect(tokenizeAndHumanizeParts('{{ "{" }}')).toEqual([
|
557 | 593 | [lex.TokenType.TEXT, '{{ "{" }}'],
|
|
0 commit comments