Skip to content

Commit 4f18ac2

Browse files
authored
docs: update README.md (#44)
1 parent 71ca51a commit 4f18ac2

File tree

5 files changed

+31
-11
lines changed

5 files changed

+31
-11
lines changed

.github/workflows/augular-html-parser-continuous-integration.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: CI
33
on:
44
push:
55
branches:
6-
- main
6+
# @fisker don't run on main branch, since workflows there are from upstream
7+
- dev
78
pull_request:
89

910
permissions:

packages/angular-html-parser/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ An HTML parser extracted from Angular with some [modifications](#modifications)
66

77
[Changelog](https://github.com/prettier/angular-html-parser/blob/master/packages/angular-html-parser/CHANGELOG.md)
88

9+
## Diff from upstream
10+
11+
[Link](https://github.com/prettier/angular-html-parser/compare/main...prettier:angular-html-parser:dev)
12+
13+
> [!TIP]
14+
> Try sync `main` and `dev` branch with upstream first
15+
916
## Install
1017

1118
```sh

packages/angular-html-parser/vitest.config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { defineConfig } from "vitest/config";
33
export default defineConfig({
44
test: {
55
globals: true,
6-
include: [
7-
"../compiler/test/ml_parser/*_spec.ts",
8-
"./test/*_spec.ts",
9-
],
6+
include: ["../compiler/test/ml_parser/*_spec.ts", "./test/*_spec.ts"],
107
coverage: {
118
enabled: Boolean(process.env.CI),
129
provider: "v8",

packages/angular-html-parser/yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4309,11 +4309,11 @@ __metadata:
43094309

43104310
"typescript@patch:typescript@npm%3A5.8.2#optional!builtin<compat/typescript>":
43114311
version: 5.8.2
4312-
resolution: "typescript@patch:typescript@npm%3A5.8.2#optional!builtin<compat/typescript>::version=5.8.2&hash=8c6c40"
4312+
resolution: "typescript@patch:typescript@npm%3A5.8.2#optional!builtin<compat/typescript>::version=5.8.2&hash=5786d5"
43134313
bin:
43144314
tsc: bin/tsc
43154315
tsserver: bin/tsserver
4316-
checksum: 10/6ae9b2c4d3254ec2eaee6f26ed997e19c02177a212422993209f81e87092b2bb0a4738085549c5b0164982a5609364c047c72aeb281f6c8d802cd0d1c6f0d353
4316+
checksum: 10/97920a082ffc57583b1cb6bc4faa502acc156358e03f54c7fc7fdf0b61c439a717f4c9070c449ee9ee683d4cfc3bb203127c2b9794b2950f66d9d307a4ff262c
43174317
languageName: node
43184318
linkType: hard
43194319

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)