-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: trim framework-supplied attributes in CSR (#281)
- Loading branch information
1 parent
3a0f5eb
commit 053e151
Showing
6 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
9 changes: 9 additions & 0 deletions
9
...src/modules/serializer/frameworkAttrs/__tests__/__snapshots__/frameworkAttrs.spec.js.snap
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,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`serializes a component containing framework-supplied attributes 1`] = ` | ||
<serializer-component> | ||
<h1> | ||
Hello world | ||
</h1> | ||
</serializer-component> | ||
`; |
15 changes: 15 additions & 0 deletions
15
test/src/modules/serializer/frameworkAttrs/__tests__/frameworkAttrs.spec.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,15 @@ | ||
/* | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: MIT | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
*/ | ||
import { createElement } from 'lwc'; | ||
import FrameworkAttrs from '../frameworkAttrs'; | ||
|
||
it('serializes a component containing framework-supplied attributes', () => { | ||
const elm = createElement('serializer-component', { is: FrameworkAttrs }); | ||
document.body.appendChild(elm); | ||
|
||
expect(elm).toMatchSnapshot(); | ||
}); |
3 changes: 3 additions & 0 deletions
3
test/src/modules/serializer/frameworkAttrs/frameworkAttrs.css
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,3 @@ | ||
h1 { | ||
color: blue; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/src/modules/serializer/frameworkAttrs/frameworkAttrs.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,3 @@ | ||
<template lwc:render-mode="light"> | ||
<h1>Hello world</h1> | ||
</template> |
18 changes: 18 additions & 0 deletions
18
test/src/modules/serializer/frameworkAttrs/frameworkAttrs.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,18 @@ | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: MIT | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
*/ | ||
|
||
import { LightningElement } from 'lwc'; | ||
|
||
export default class FrameworkAttrs extends LightningElement { | ||
static renderMode = 'light'; | ||
|
||
connectedCallback() { | ||
// Typically this is only added by the framework itself, but here we are explicitly adding it | ||
// to make the test simpler | ||
this.setAttribute('data-lwc-host-mutated', ''); | ||
} | ||
} |