Skip to content

docs: update README.md #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: CI
on:
push:
branches:
- main
# @fisker don't run on main branch, since workflows there are from upstream
- dev
pull_request:

permissions:
Expand Down
7 changes: 7 additions & 0 deletions packages/angular-html-parser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ An HTML parser extracted from Angular with some [modifications](#modifications)

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

## Diff from upstream

[Link](https://github.com/prettier/angular-html-parser/compare/main...prettier:angular-html-parser:dev)

> [!TIP]
> Try sync `main` and `dev` branch with upstream first
## Install

```sh
Expand Down
5 changes: 1 addition & 4 deletions packages/angular-html-parser/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
globals: true,
include: [
"../compiler/test/ml_parser/*_spec.ts",
"./test/*_spec.ts",
],
include: ["../compiler/test/ml_parser/*_spec.ts", "./test/*_spec.ts"],
coverage: {
enabled: Boolean(process.env.CI),
provider: "v8",
Expand Down
4 changes: 2 additions & 2 deletions packages/angular-html-parser/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4309,11 +4309,11 @@ __metadata:

"typescript@patch:typescript@npm%3A5.8.2#optional!builtin<compat/typescript>":
version: 5.8.2
resolution: "typescript@patch:typescript@npm%3A5.8.2#optional!builtin<compat/typescript>::version=5.8.2&hash=8c6c40"
resolution: "typescript@patch:typescript@npm%3A5.8.2#optional!builtin<compat/typescript>::version=5.8.2&hash=5786d5"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/6ae9b2c4d3254ec2eaee6f26ed997e19c02177a212422993209f81e87092b2bb0a4738085549c5b0164982a5609364c047c72aeb281f6c8d802cd0d1c6f0d353
checksum: 10/97920a082ffc57583b1cb6bc4faa502acc156358e03f54c7fc7fdf0b61c439a717f4c9070c449ee9ee683d4cfc3bb203127c2b9794b2950f66d9d307a4ff262c
languageName: node
linkType: hard

Expand Down
23 changes: 19 additions & 4 deletions packages/compiler/test/ml_parser/html_parser_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ describe('HtmlParser', () => {
expect((ast.rootNodes[0] as html.Element).attrs[0].valueSpan).toBeUndefined();
});

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

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

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

// angular-html-parser: parse differently
it('should also report lexer errors', () => {
const errors = parser.parse('<!-err--><div></p></div>', 'TestComp').errors;
expect(errors.length).toEqual(2);
expect(errors.length).toEqual(1);
expect(humanizeErrors(errors)).toEqual([
[TokenType.COMMENT_START, 'Unexpected character "e"', '0:3'],
[
'p',
'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',
'0:14',
],
]);
});

// it('should also report lexer errors', () => {
// const errors = parser.parse('<!-err--><div></p></div>', 'TestComp').errors;
// expect(errors.length).toEqual(2);
// expect(humanizeErrors(errors)).toEqual([
// [TokenType.COMMENT_START, 'Unexpected character "e"', '0:3'],
// [
// 'p',
// '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',
// '0:14',
// ],
// ]);
// });
});
});
});
Expand Down