-
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.
fix: trim
data-lwc-host-mutated
attr values (#283)
- Loading branch information
1 parent
5d7e988
commit f75ffc0
Showing
11 changed files
with
102 additions
and
2 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
...izer/frameworkAttrsWithValue/__tests__/__snapshots__/frameworkAttrsWithValue.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
.../src/modules/serializer/frameworkAttrsWithValue/__tests__/frameworkAttrsWithValue.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 FrameworkAttrsWithValue from '../frameworkAttrsWithValue'; | ||
|
||
it('serializes a component containing framework-supplied attributes', () => { | ||
const elm = createElement('serializer-component', { is: FrameworkAttrsWithValue }); | ||
document.body.appendChild(elm); | ||
|
||
expect(elm).toMatchSnapshot(); | ||
}); |
3 changes: 3 additions & 0 deletions
3
test/src/modules/serializer/frameworkAttrsWithValue/frameworkAttrsWithValue.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/frameworkAttrsWithValue/frameworkAttrsWithValue.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/frameworkAttrsWithValue/frameworkAttrsWithValue.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 FrameworkAttrsWithValue 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', 'class data-foo'); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
.../frameworkAttrsWithValue/__tests__/__snapshots__/frameworkAttrsWithValue.ssr-test.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,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`serializes component with framework-supplied attributes with value 1`] = ` | ||
<x-basic> | ||
<style type="text/css"> | ||
h1 {color: blue;} | ||
</style> | ||
<h1> | ||
Hello world | ||
</h1> | ||
</x-basic> | ||
`; |
14 changes: 14 additions & 0 deletions
14
test/src/modules/ssr/frameworkAttrsWithValue/__tests__/frameworkAttrsWithValue.ssr-test.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,14 @@ | ||
/* | ||
* 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 { renderComponent } from 'lwc'; | ||
import FrameworkAttrsWithValue from '../frameworkAttrsWithValue'; | ||
|
||
it('serializes component with framework-supplied attributes with value', () => { | ||
const renderedComponent = renderComponent('x-basic', FrameworkAttrsWithValue, {}); | ||
|
||
expect(renderedComponent).toMatchSnapshot(); | ||
}); |
3 changes: 3 additions & 0 deletions
3
test/src/modules/ssr/frameworkAttrsWithValue/frameworkAttrsWithValue.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/ssr/frameworkAttrsWithValue/frameworkAttrsWithValue.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/ssr/frameworkAttrsWithValue/frameworkAttrsWithValue.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 FrameworkAttrsWithValue 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', 'class data-foo'); | ||
} | ||
} |