Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Angular: allow self-closing tags on custom elements (#14170)
Fixes #14168
- Loading branch information
Showing
5 changed files
with
79 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#### Allow self-closing tags on custom elements (#14170 by @fisker) | ||
|
||
See [Angular v15.1.0 release note](https://github.com/angular/angular/releases/tag/15.1.0) for details. | ||
|
||
<!-- prettier-ignore --> | ||
```html | ||
// Input | ||
<app-test/> | ||
|
||
// Prettier stable | ||
SyntaxError: Only void and foreign elements can be self closed "app-test" (1:1) | ||
> 1 | <app-test/> | ||
| ^^^^^^^^^ | ||
2 | | ||
|
||
// Prettier main | ||
<app-test /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/format/angular/self-closing/__snapshots__/jsfmt.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`self-closing.component.html format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["angular"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
<app-test/> | ||
<app-test /> | ||
<app-test | ||
/> | ||
<img> | ||
<img/> | ||
<img /> | ||
<img | ||
/> | ||
<div/> | ||
<div /> | ||
<div | ||
/> | ||
=====================================output===================================== | ||
<app-test /> | ||
<app-test /> | ||
<app-test /> | ||
<img /> | ||
<img /> | ||
<img /> | ||
<img /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
================================================================================ | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
run_spec(__dirname, ["angular"]); |
13 changes: 13 additions & 0 deletions
13
tests/format/angular/self-closing/self-closing.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<app-test/> | ||
<app-test /> | ||
<app-test | ||
/> | ||
<img> | ||
<img/> | ||
<img /> | ||
<img | ||
/> | ||
<div/> | ||
<div /> | ||
<div | ||
/> |