Skip to content

Commit bfb4500

Browse files
committed
test: fix more tests
1 parent 2f5b4e6 commit bfb4500

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

packages/compiler/test/ml_parser/html_parser_spec.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ describe('HtmlParser', () => {
13091309
expect((ast.rootNodes[0] as html.Element).attrs[0].valueSpan).toBeUndefined();
13101310
});
13111311

1312-
it.only('should report a value span for an attribute with a value', () => {
1312+
it('should report a value span for an attribute with a value', () => {
13131313
const ast = parser.parse('<div bar="12"></div>', 'TestComp');
13141314
const attr = (ast.rootNodes[0] as html.Element).attrs[0];
13151315
// angular-html-parser: valueSpan contains quotes
@@ -1340,7 +1340,9 @@ describe('HtmlParser', () => {
13401340

13411341
it('should visit attribute nodes', () => {
13421342
const result = humanizeDom(parser.parse('<div id="foo"></div>', 'TestComp'));
1343-
expect(result).toContain([html.Attribute, 'id', 'foo', ['foo']]);
1343+
// angular-html-parser: different assertion between test libs
1344+
expect(result).toContainEqual([html.Attribute, 'id', 'foo', ['foo']]);
1345+
// expect(result).toContain([html.Attribute, 'id', 'foo', ['foo']]);
13441346
});
13451347

13461348
it('should visit all nodes', () => {
@@ -1533,18 +1535,31 @@ describe('HtmlParser', () => {
15331535
expect(parser.parse('<my-cmp />', 'TestComp').errors).toEqual([]);
15341536
});
15351537

1538+
// angular-html-parser: parse differently
15361539
it('should also report lexer errors', () => {
15371540
const errors = parser.parse('<!-err--><div></p></div>', 'TestComp').errors;
1538-
expect(errors.length).toEqual(2);
1541+
expect(errors.length).toEqual(1);
15391542
expect(humanizeErrors(errors)).toEqual([
1540-
[TokenType.COMMENT_START, 'Unexpected character "e"', '0:3'],
15411543
[
15421544
'p',
15431545
'Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags',
15441546
'0:14',
15451547
],
15461548
]);
15471549
});
1550+
1551+
// it('should also report lexer errors', () => {
1552+
// const errors = parser.parse('<!-err--><div></p></div>', 'TestComp').errors;
1553+
// expect(errors.length).toEqual(2);
1554+
// expect(humanizeErrors(errors)).toEqual([
1555+
// [TokenType.COMMENT_START, 'Unexpected character "e"', '0:3'],
1556+
// [
1557+
// 'p',
1558+
// 'Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags',
1559+
// '0:14',
1560+
// ],
1561+
// ]);
1562+
// });
15481563
});
15491564
});
15501565
});

0 commit comments

Comments
 (0)