summaryrefslogtreecommitdiff
path: root/tests/testdata
diff options
context:
space:
mode:
authorPig Fang <g-plane@hotmail.com>2024-08-15 04:58:48 +0800
committerGitHub <noreply@github.com>2024-08-14 22:58:48 +0200
commit3a3315cc7f3466ce229f6f150402d5ccf72b3d1d (patch)
treea0299679b2c1eb1cee496905caab380a95f22813 /tests/testdata
parent22a834ff5b4b312b8f91be8991f2b495d49fad2f (diff)
feat(fmt): support HTML, Svelte, Vue, Astro and Angular (#25019)
This commit adds capability to format HTML, Svelte, Vue, Astro and Angular files. "--unstable-html" is required to format HTML files, and "--unstable-component" flag is needed to format other formats. These can also be specified in the config file. Close #25015
Diffstat (limited to 'tests/testdata')
-rw-r--r--tests/testdata/fmt/badly_formatted.html9
-rw-r--r--tests/testdata/fmt/badly_formatted.md10
-rw-r--r--tests/testdata/fmt/badly_formatted.svelte10
-rw-r--r--tests/testdata/fmt/badly_formatted_fixed.html11
-rw-r--r--tests/testdata/fmt/badly_formatted_fixed.md10
-rw-r--r--tests/testdata/fmt/badly_formatted_fixed.svelte10
6 files changed, 60 insertions, 0 deletions
diff --git a/tests/testdata/fmt/badly_formatted.html b/tests/testdata/fmt/badly_formatted.html
new file mode 100644
index 000000000..de7706ac7
--- /dev/null
+++ b/tests/testdata/fmt/badly_formatted.html
@@ -0,0 +1,9 @@
+<div class=container > content </div>
+
+<script>
+let counter=0
+</script>
+
+<style>
+.container{padding:8px}
+</style>
diff --git a/tests/testdata/fmt/badly_formatted.md b/tests/testdata/fmt/badly_formatted.md
index 29d73b365..642918cea 100644
--- a/tests/testdata/fmt/badly_formatted.md
+++ b/tests/testdata/fmt/badly_formatted.md
@@ -53,3 +53,13 @@ function foo(): number {
```css
#app>.btn{ color : #000 }
```
+
+```html
+<div class=container > content </div>
+```
+
+```svelte
+<script lang=ts>
+let a:number
+</script>
+```
diff --git a/tests/testdata/fmt/badly_formatted.svelte b/tests/testdata/fmt/badly_formatted.svelte
new file mode 100644
index 000000000..9c1988d3a
--- /dev/null
+++ b/tests/testdata/fmt/badly_formatted.svelte
@@ -0,0 +1,10 @@
+<script lang="ts">
+let a:number
+let b : number
+</script>
+
+<div class:active={ active } style=" width : 1PX; height:1PX; " > {a+b} </div>
+
+<style>
+.active{}
+</style>
diff --git a/tests/testdata/fmt/badly_formatted_fixed.html b/tests/testdata/fmt/badly_formatted_fixed.html
new file mode 100644
index 000000000..c0c06cd9b
--- /dev/null
+++ b/tests/testdata/fmt/badly_formatted_fixed.html
@@ -0,0 +1,11 @@
+<div class="container">content</div>
+
+<script>
+ let counter = 0;
+</script>
+
+<style>
+ .container {
+ padding: 8px;
+ }
+</style>
diff --git a/tests/testdata/fmt/badly_formatted_fixed.md b/tests/testdata/fmt/badly_formatted_fixed.md
index db2afc809..21176742b 100644
--- a/tests/testdata/fmt/badly_formatted_fixed.md
+++ b/tests/testdata/fmt/badly_formatted_fixed.md
@@ -46,3 +46,13 @@ function foo(): number {
color: #000;
}
```
+
+```html
+<div class="container">content</div>
+```
+
+```svelte
+<script lang="ts">
+ let a: number;
+</script>
+```
diff --git a/tests/testdata/fmt/badly_formatted_fixed.svelte b/tests/testdata/fmt/badly_formatted_fixed.svelte
new file mode 100644
index 000000000..7557e758d
--- /dev/null
+++ b/tests/testdata/fmt/badly_formatted_fixed.svelte
@@ -0,0 +1,10 @@
+<script lang="ts">
+ let a: number;
+ let b: number;
+</script>
+
+<div class:active style="width: 1px; height: 1px">{a + b}</div>
+
+<style>
+ .active {}
+</style>