Skip to content

Commit 80797a8

Browse files
committed
test(consistent-selector-style): Added tests for repeated elements
1 parent 04ca0d1 commit 80797a8

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

packages/eslint-plugin-svelte/tests/fixtures/rules/consistent-selector-style/valid/id-class-type/class01-input.svelte

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010

1111
<b class:conditional={true}>Text 3</b>
1212

13+
{#each ["one", "two"] as iter}
14+
<span class="iterated-each">{iter}</span>
15+
{/each}
16+
17+
<CustomComponent>
18+
<span class="iterated-component">Text 5</span>
19+
</CustomComponent>
20+
1321
<style>
1422
.link {
1523
color: red;
@@ -38,4 +46,12 @@
3846
.conditional {
3947
color: red;
4048
}
49+
50+
.iterated-each {
51+
color: red;
52+
}
53+
54+
.iterated-component {
55+
color: red;
56+
}
4157
</style>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelte": ">=5.0.0"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{#snippet iterated()}
2+
<span class="iterated-snippet">Text 4</span>
3+
{/snippet}
4+
5+
<style>
6+
.iterated-snippet {
7+
color: red;
8+
}
9+
</style>

packages/eslint-plugin-svelte/tests/fixtures/rules/consistent-selector-style/valid/type-id-class/class-dynamic-suffix01-input.svelte

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
<a class={derived}>Click me four!</a>
2121

22+
{#each ["one", "two"] as count}
23+
<b class={"bold-" + count}>Bold in each</b>
24+
{/each}
25+
2226
<style>
2327
.foo-link-one {
2428
color: red;
@@ -31,4 +35,12 @@
3135
.foo-link-three {
3236
color: red;
3337
}
38+
39+
.bold-one {
40+
color: red;
41+
}
42+
43+
.bold-two {
44+
color: blue;
45+
}
3446
</style>

0 commit comments

Comments
 (0)