diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/different-priority/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/different-priority/index.spec.js new file mode 100644 index 0000000000..195caa61ac --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/different-priority/index.spec.js @@ -0,0 +1,30 @@ +export default { + props: { + dynamicStyle: 'background-color: red; border-color: red;', + }, + clientProps: { + dynamicStyle: 'background-color: red; border-color: red !important;', + }, + snapshot(target) { + const p = target.shadowRoot.querySelector('p'); + return { + p, + style: p.getAttribute('style'), + }; + }, + test(target, snapshots, consoleCalls) { + const p = target.shadowRoot.querySelector('p'); + + expect(p).not.toBe(snapshots.p); + expect(p.getAttribute('style')).not.toBe(snapshots.style); + expect(p.getAttribute('style')).toBe( + 'background-color: red; border-color: red !important;' + ); + + expect(consoleCalls.error).toHaveSize(2); + expect(consoleCalls.error[0][0].message).toContain( + '[LWC error]: Mismatch hydrating element

: attribute "style" has different values, expected "background-color: red; border-color: red !important;" but found "background-color: red; border-color: red;"' + ); + expect(consoleCalls.error[1][0].message).toContain('Hydration completed with errors.'); + }, +}; diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/different-priority/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/different-priority/x/main/main.html new file mode 100644 index 0000000000..16a9ea3139 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/different-priority/x/main/main.html @@ -0,0 +1,3 @@ + diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/different-priority/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/different-priority/x/main/main.js new file mode 100644 index 0000000000..d85340d1f4 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/different-priority/x/main/main.js @@ -0,0 +1,5 @@ +import { LightningElement, api } from 'lwc'; + +export default class Main extends LightningElement { + @api dynamicStyle; +} diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/index.spec.js new file mode 100644 index 0000000000..1a185fdd1c --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/index.spec.js @@ -0,0 +1,30 @@ +export default { + props: { + dynamicStyle: 'background-color: red; border-color: red;', + }, + clientProps: { + dynamicStyle: 'background-color: red; border-color: red; margin: 1px;', + }, + snapshot(target) { + const p = target.shadowRoot.querySelector('p'); + return { + p, + style: p.getAttribute('style'), + }; + }, + test(target, snapshots, consoleCalls) { + const p = target.shadowRoot.querySelector('p'); + + expect(p).not.toBe(snapshots.p); + expect(p.getAttribute('style')).not.toBe(snapshots.style); + expect(p.getAttribute('style')).toBe( + 'background-color: red; border-color: red; margin: 1px;' + ); + + expect(consoleCalls.error).toHaveSize(2); + expect(consoleCalls.error[0][0].message).toContain( + 'Mismatch hydrating element

: attribute "style" has different values, expected "background-color: red; border-color: red; margin: 1px;" but found "background-color: red; border-color: red;"' + ); + expect(consoleCalls.error[1][0].message).toContain('Hydration completed with errors.'); + }, +}; diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/x/main/main.html new file mode 100644 index 0000000000..16a9ea3139 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/x/main/main.html @@ -0,0 +1,3 @@ + diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/x/main/main.js new file mode 100644 index 0000000000..d85340d1f4 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/x/main/main.js @@ -0,0 +1,5 @@ +import { LightningElement, api } from 'lwc'; + +export default class Main extends LightningElement { + @api dynamicStyle; +} diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/index.spec.js new file mode 100644 index 0000000000..ce0cb340a6 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/index.spec.js @@ -0,0 +1,28 @@ +export default { + props: { + dynamicStyle: 'background-color: red; border-color: red; margin: 1px;', + }, + clientProps: { + dynamicStyle: 'background-color: red; border-color: red;', + }, + snapshot(target) { + const p = target.shadowRoot.querySelector('p'); + return { + p, + style: p.getAttribute('style'), + }; + }, + test(target, snapshots, consoleCalls) { + const p = target.shadowRoot.querySelector('p'); + + expect(p).not.toBe(snapshots.p); + expect(p.getAttribute('style')).not.toBe(snapshots.style); + expect(p.getAttribute('style')).toBe('background-color: red; border-color: red;'); + + expect(consoleCalls.error).toHaveSize(2); + expect(consoleCalls.error[0][0].message).toContain( + '[LWC error]: Mismatch hydrating element

: attribute "style" has different values, expected "background-color: red; border-color: red;" but found "background-color: red; border-color: red; margin: 1px;"' + ); + expect(consoleCalls.error[1][0].message).toContain('Hydration completed with errors.'); + }, +}; diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/x/main/main.html new file mode 100644 index 0000000000..16a9ea3139 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/x/main/main.html @@ -0,0 +1,3 @@ + diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/x/main/main.js new file mode 100644 index 0000000000..d85340d1f4 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/x/main/main.js @@ -0,0 +1,5 @@ +import { LightningElement, api } from 'lwc'; + +export default class Main extends LightningElement { + @api dynamicStyle; +} diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-different-order/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-different-order/index.spec.js new file mode 100644 index 0000000000..4032ddf86a --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-different-order/index.spec.js @@ -0,0 +1,29 @@ +export default { + props: { + dynamicStyle: 'background-color: red; border-color: red; margin: 1px;', + }, + clientProps: { + dynamicStyle: 'margin: 1px; border-color: red; background-color: red;', + }, + snapshot(target) { + const p = target.shadowRoot.querySelector('p'); + return { + p, + style: p.getAttribute('style'), + }; + }, + test(target, snapshots, consoleCalls) { + const p = target.shadowRoot.querySelector('p'); + + expect(p).not.toBe(snapshots.p); + expect(p.getAttribute('style')).toBe( + 'margin: 1px; border-color: red; background-color: red;' + ); + + expect(consoleCalls.error).toHaveSize(2); + expect(consoleCalls.error[0][0].message).toContain( + 'Mismatch hydrating element

: attribute "style" has different values, expected "margin: 1px; border-color: red; background-color: red;" but found "background-color: red; border-color: red; margin: 1px;"' + ); + expect(consoleCalls.error[1][0].message).toContain('Hydration completed with errors.'); + }, +}; diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-different-order/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-different-order/x/main/main.html new file mode 100644 index 0000000000..16a9ea3139 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-different-order/x/main/main.html @@ -0,0 +1,3 @@ + diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-different-order/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-different-order/x/main/main.js new file mode 100644 index 0000000000..d85340d1f4 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-different-order/x/main/main.js @@ -0,0 +1,5 @@ +import { LightningElement, api } from 'lwc'; + +export default class Main extends LightningElement { + @api dynamicStyle; +} diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-priority/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-priority/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-priority/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-priority/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-priority/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-priority/x/main/main.html new file mode 100644 index 0000000000..16a9ea3139 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-priority/x/main/main.html @@ -0,0 +1,3 @@ + diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-priority/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-priority/x/main/main.js new file mode 100644 index 0000000000..a77cebf3ac --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same-priority/x/main/main.js @@ -0,0 +1,6 @@ +import { LightningElement } from 'lwc'; + +export default class Main extends LightningElement { + // Note: extra spaces matters + dynamicStyle = 'background-color: red; border-color: red !important ; '; +} diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/x/main/main.html new file mode 100644 index 0000000000..16a9ea3139 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/x/main/main.html @@ -0,0 +1,3 @@ + diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/x/main/main.js new file mode 100644 index 0000000000..6c6ffd4122 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/x/main/main.js @@ -0,0 +1,5 @@ +import { LightningElement, api } from 'lwc'; + +export default class Main extends LightningElement { + @api dynamicStyle = 'background-color: red; border-color: red; margin: 1px;'; +} diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-different-priority/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/different-priority/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-different-priority/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/different-priority/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-different-priority/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/different-priority/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-different-priority/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/different-priority/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-different-priority/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/different-priority/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-different-priority/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/different-priority/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-client/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-client/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-client/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-client/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-client/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-client/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-client/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-client/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-client/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-client/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-client/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-client/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-server/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-server/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-server/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-server/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-server/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-server/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-server/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-server/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-server/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-server/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-extra-from-server/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/extra-from-server/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-different-order/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-different-order/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-different-order/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-different-order/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-different-order/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-different-order/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-different-order/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-different-order/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-different-order/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-different-order/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-different-order/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-different-order/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-priority/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-priority/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-priority/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-priority/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-priority/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-priority/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-priority/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-priority/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-priority/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-priority/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same-priority/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same-priority/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-same/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/same/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-different-priority/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-different-priority/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-different-priority/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-different-priority/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-different-priority/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-different-priority/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-different-priority/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-different-priority/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-different-priority/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-different-priority/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-different-priority/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-different-priority/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-client/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-client/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-client/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-client/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-client/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-client/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-client/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-client/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-client/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-client/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-client/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-client/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-server/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-server/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-server/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-server/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-server/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-server/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-server/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-server/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-server/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-server/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-extra-from-server/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-extra-from-server/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-different-order/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-different-order/index.spec.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-different-order/index.spec.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-different-order/index.spec.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-different-order/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-different-order/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-different-order/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-different-order/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-different-order/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-different-order/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-different-order/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-different-order/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-priority/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-priority/index.spec.js new file mode 100644 index 0000000000..06a355fde7 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-priority/index.spec.js @@ -0,0 +1,15 @@ +export default { + snapshot(target) { + const p = target.shadowRoot.querySelector('p'); + return { + p, + style: p.getAttribute('style'), + }; + }, + test(target, snapshots) { + const p = target.shadowRoot.querySelector('p'); + + expect(p).toBe(snapshots.p); + expect(p.getAttribute('style')).toBe(snapshots.style); + }, +}; diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-priority/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-priority/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-priority/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-priority/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-priority/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-priority/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same-priority/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same-priority/x/main/main.js diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same/index.spec.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same/index.spec.js new file mode 100644 index 0000000000..fd3dbd4c66 --- /dev/null +++ b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same/index.spec.js @@ -0,0 +1,17 @@ +export default { + snapshot(target) { + const p = target.shadowRoot.querySelector('p'); + return { + p, + style: p.getAttribute('style'), + }; + }, + test(target, snapshots, consoleCalls) { + const p = target.shadowRoot.querySelector('p'); + + expect(p).toBe(snapshots.p); + expect(p.getAttribute('style')).toBe(snapshots.style); + + expect(consoleCalls.error).toHaveSize(0); + }, +}; diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same/x/main/main.html b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same/x/main/main.html similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same/x/main/main.html rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same/x/main/main.html diff --git a/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same/x/main/main.js b/packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same/x/main/main.js similarity index 100% rename from packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static-unoptimized-same/x/main/main.js rename to packages/@lwc/integration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same/x/main/main.js