-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement remaining ClassList methods (#5233)
* feat: implement remaining ClassList methods * test: getter-class-list-modify * chore: bump ci * chore: add failing fixture test for SSRv1
- Loading branch information
Showing
7 changed files
with
67 additions
and
22 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list-modify/config.json
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,7 @@ | ||
{ | ||
"entry": "x/getter-class-list", | ||
"ssrFiles": { | ||
"error": "error-ssr.txt", | ||
"expected": "expected-ssr.html" | ||
} | ||
} |
Empty file.
1 change: 1 addition & 0 deletions
1
packages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list-modify/error.txt
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 @@ | ||
classList.forEach is not a function |
4 changes: 4 additions & 0 deletions
4
...ages/@lwc/engine-server/src/__tests__/fixtures/getter-class-list-modify/expected-ssr.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,4 @@ | ||
<fixture-test class="a b c d-e f g h i" data-lwc-host-mutated="class"> | ||
<template shadowrootmode="open"> | ||
</template> | ||
</fixture-test> |
Empty file.
25 changes: 25 additions & 0 deletions
25
...ests__/fixtures/getter-class-list-modify/modules/x/getter-class-list/getter-class-list.js
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,25 @@ | ||
import { expect } from 'vitest'; | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class GetterClassList extends LightningElement { | ||
connectedCallback() { | ||
const { classList } = this; | ||
|
||
classList.add('a', 'b', 'c', 'd-e', 'f', 'g', 'h', 'i'); | ||
classList.forEach((value) => { | ||
classList.remove(value); | ||
}); | ||
expect(this.getAttribute('class')).toBe(''); | ||
expect(this.classList.length).toBe(0); | ||
|
||
classList.add('a', 'b', 'c', 'd-e', 'f', 'g', 'h', 'i'); | ||
while (classList.length > 0) { | ||
classList.remove(classList.item(0)); | ||
} | ||
expect(this.getAttribute('class')).toBe(''); | ||
expect(this.classList.length).toBe(0); | ||
|
||
classList.add('a', 'b', 'c', 'd-e', 'f', 'g', 'h', 'i'); | ||
expect(classList.item(3)).toBe('d-e'); | ||
} | ||
} |
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