Skip to content

Commit

Permalink
fix: v2 hydration test failures (#5227)
Browse files Browse the repository at this point in the history
* fix: fixed class mutation, added test coverage, removed failure supression

* fix: unnecessary fixture pathing
  • Loading branch information
jhefferman-sfdc authored Feb 19, 2025
1 parent 34c7522 commit 7a761c4
Show file tree
Hide file tree
Showing 65 changed files with 287 additions and 152 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"entry": "x/parent"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<fixture-test>
<template shadowrootmode="open">
<x-child class="connected-callback-class connected-callback-class-2 initial" data-lwc-host-mutated="class">
<template shadowrootmode="open">
</template>
</x-child>
</template>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
connectedCallback() {
// Modify a class that has already been set by the parent
this.classList.add('connected-callback-class');
this.classList.add('connected-callback-class-2');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<x-child class="initial"></x-child>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<template>
</template>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<fixture-test>
<template shadowrootmode="open">
<div data-expect-no-warning data-id="div-inner-static" inner-h-t-m-l="replaced">
original
</div>
<div data-expect-no-warning data-id="div-inner-computed" inner-h-t-m-l="injected">
original
</div>
<div data-id="div-inner-spread">
original
</div>
<span>
lwc:inner-html
</span>
<p>
injected
</p>
</template>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<div data-id="div-inner-static" data-expect-no-warning inner-h-t-m-l="replaced">original</div>
<div data-id="div-inner-computed" data-expect-no-warning inner-h-t-m-l={computed}>original</div>
<div data-id="div-inner-spread" lwc:spread={spread}>original</div>

<span lwc:inner-html="lwc:inner-html"></span>
<p lwc:inner-html={computed}></p>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"entry": "x/inner",
"ssrFiles": {
"error": "error-ssr.txt",
"expected": "expected-ssr.html"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cannot set attribute "inner-h-t-m-l" on <omg-whatever>.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<fixture-test>
<template shadowrootmode="open">
<omg-whatever data-id="external-inner-static" inner-h-t-m-l="replaced">
original
</omg-whatever>
<omg-whatever data-id="external-inner-computed" inner-h-t-m-l="injected">
original
</omg-whatever>
<omg-whatever data-id="external-inner-spread">
original
</omg-whatever>
</template>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<omg-whatever lwc:external data-id="external-inner-static" inner-h-t-m-l="replaced">original</omg-whatever>
<omg-whatever lwc:external data-id="external-inner-computed" inner-h-t-m-l={computed}>original</omg-whatever>
<omg-whatever lwc:external data-id="external-inner-spread" lwc:spread={spread}>original</omg-whatever>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
computed = 'injected';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"entry": "x/inner",
"ssrFiles": {
"error": "error-ssr.txt",
"expected": "expected-ssr.html"
}
}
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<fixture-test>
<template shadowrootmode="open">
<x-component data-id="cmp-inner-static">
<template shadowrootmode="open">
<slot>
</slot>
</template>
original
</x-component>
<x-component data-id="cmp-inner-computed">
<template shadowrootmode="open">
<slot>
</slot>
</template>
original
</x-component>
<x-component data-id="cmp-inner-spread">
<template shadowrootmode="open">
<slot>
</slot>
</template>
original
</x-component>
</template>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<fixture-test>
<template shadowrootmode="open">
<x-component data-id="cmp-inner-static">
<template shadowrootmode="open">
<slot>
</slot>
</template>
original
</x-component>
<x-component data-id="cmp-inner-computed">
<template shadowrootmode="open">
<slot>
</slot>
</template>
original
</x-component>
<x-component data-id="cmp-inner-spread">
<template shadowrootmode="open">
<slot>
</slot>
</template>
original
</x-component>
</template>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<x-component data-id="cmp-inner-static" inner-h-t-m-l="replaced">original</x-component>
<x-component data-id="cmp-inner-computed" inner-h-t-m-l={computed}>original</x-component>
<x-component data-id="cmp-inner-spread" lwc:spread={spread}>original</x-component>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
computed = 'injected';
spread = { innerHTML: 'wheeeeeeeeeeeeeeeeeeeeeeeeeee' };
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"entry": "x/outer",
"ssrFiles": {
"error": "error-ssr.txt",
"expected": "expected-ssr.html"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cannot set attribute "outer-h-t-m-l" on <div>.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<fixture-test>
<template shadowrootmode="open">
<div data-expect-no-warning data-id="div-outer-static" outer-h-t-m-l="replaced">
original
</div>
<div data-expect-no-warning data-id="div-outer-computed" outer-h-t-m-l="injected">
original
</div>
<div data-id="div-outer-spread">
original
</div>
<span>
lwc:inner-html
</span>
<p>
injected
</p>
</template>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<div data-id="div-outer-static" data-expect-no-warning outer-h-t-m-l="replaced">original</div>
<div data-id="div-outer-computed" data-expect-no-warning outer-h-t-m-l={computed}>original</div>
<div data-id="div-outer-spread" lwc:spread={spread}>original</div>

<span lwc:inner-html="lwc:inner-html"></span>
<p lwc:inner-html={computed}></p>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
computed = 'injected';
spread = { innerHTML: 'wheeeeeeeeeeeeeeeeeeeeeeeeeee' };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"entry": "x/outer",
"ssrFiles": {
"error": "error-ssr.txt",
"expected": "expected-ssr.html"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cannot set attribute "outer-h-t-m-l" on <omg-whatever>.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<fixture-test>
<template shadowrootmode="open">
<omg-whatever data-id="external-outer-static">
original
</omg-whatever>
<omg-whatever data-id="external-outer-computed">
original
</omg-whatever>
<omg-whatever data-id="external-outer-spread">
original
</omg-whatever>
</template>
</fixture-test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<omg-whatever lwc:external data-id="external-outer-static" outer-h-t-m-l="replaced">original</omg-whatever>
<omg-whatever lwc:external data-id="external-outer-computed" outer-h-t-m-l={computed}>original</omg-whatever>
<omg-whatever lwc:external data-id="external-outer-spread" lwc:spread={spread}>original</omg-whatever>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
computed = 'injected';
spread = { innerHTML: 'wheeeeeeeeeeeeeeeeeeeeeeeeeee' };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"entry": "x/outer"
}
Empty file.
Loading

0 comments on commit 7a761c4

Please sign in to comment.