Skip to content

Commit 6a7c9e6

Browse files
fix: review comments
1 parent d99a6e4 commit 6a7c9e6

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

packages/@lwc/integration-karma/helpers/test-hydrate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ window.HydrateTest = (function (lwc, testUtils) {
3333
}
3434

3535
function runTest(ssrRendered, Component, testConfig) {
36-
window.LwcSsrClientUtils.clearStylesheetCache();
36+
window.__lwcClearStylesheetCache();
3737
const container = appendTestTarget(ssrRendered);
3838
const selector = container.firstChild.tagName.toLowerCase();
3939
let target = container.querySelector(selector);

packages/@lwc/integration-karma/test-hydration/light-dom/scoped-styles/deduped-scoped-styles/index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default {
22
test(target, snapshot, consoleCalls) {
3-
// Expect no errors or warnings, hydration or otherwise
3+
// W-19087941: Expect no errors or warnings, hydration or otherwise
44
TestUtils.expectConsoleCalls(consoleCalls, {
55
error: [],
66
warn: [],

packages/@lwc/ssr-client-utils/src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ export function registerLwcStyleComponent() {
6161
customElements.define('lwc-style', StyleDeduplicator);
6262
}
6363

64-
/**
65-
* Clears the stylesheet cache. This is useful for testing purposes.
66-
*/
67-
export function clearStylesheetCache() {
68-
stylesheetCache.clear();
64+
// Only used in LWC's Karma tests
65+
if (process.env.NODE_ENV === 'test-karma-lwc') {
66+
(window as any).__lwcClearStylesheetCache = () => stylesheetCache.clear();
6967
}

packages/@lwc/ssr-runtime/src/styles.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ export function renderStylesheets(
7171
if (!styleDedupeIsEnabled) {
7272
const styleContents = stylesheet(token, useActualHostSelector, useNativeDirPseudoclass);
7373
validateStyleTextContents(styleContents);
74+
// TODO [#2869]: `<style>`s should not have scope token classes
7475
result += `<style${hasAnyScopedStyles ? ` class="${scopeToken}"` : ''} type="text/css">${styleContents}</style>`;
7576
} else if (stylesheetToId.has(stylesheet)) {
7677
const styleId = stylesheetToId.get(stylesheet);
77-
// TODO [#2869]: `<style>`s should not have scope token classes, but required for hydration to function correctly (W-19087941).
78+
// TODO [#2869]: `<lwc-style>`s should not have scope token classes, but required for hydration to function correctly (W-19087941).
7879
result += `<lwc-style${hasAnyScopedStyles ? ` class="${scopeToken}"` : ''} style-id="lwc-style-${styleDedupePrefix}-${styleId}"></lwc-style>`;
7980
} else {
8081
const styleId = emit.cxt.nextId++;

0 commit comments

Comments
 (0)