-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into mob/concatenate-adj…
…acent-text-nodes-party-again-yay
- Loading branch information
Showing
24 changed files
with
146 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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 { getOwnPropertyDescriptors } from '@lwc/shared'; | ||
|
||
// Like @lwc/shared, but for DOM APIs | ||
|
||
export const ElementDescriptors = getOwnPropertyDescriptors(Element.prototype); | ||
|
||
export const ElementAttachShadow = ElementDescriptors.attachShadow.value!; | ||
export const ElementShadowRootGetter = ElementDescriptors.shadowRoot.get!; |
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
2 changes: 1 addition & 1 deletion
2
...s/@lwc/engine-server/src/__tests__/fixtures/attribute-component-global-html/expected.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
2 changes: 1 addition & 1 deletion
2
...r/src/__tests__/fixtures/attribute-global-html/as-component-prop/undeclared/expected.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
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
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
packages/@lwc/integration-karma/test-hydration/attributes/non-reflective/x/child/child.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> | ||
<div>contenteditable: {contentEditable}</div> | ||
</template> |
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
packages/@lwc/integration-karma/test-hydration/attributes/non-reflective/x/main/main.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,7 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class extends LightningElement { | ||
value = { | ||
contenteditable: 'true', | ||
}; | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/@lwc/integration-karma/test-hydration/attributes/reflective/index.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,19 @@ | ||
function getAllDivs(target) { | ||
const childs = [...target.shadowRoot.querySelectorAll('x-child')]; | ||
return childs.flatMap((child) => [...child.shadowRoot.querySelectorAll('div')]); | ||
} | ||
export default { | ||
snapshot(target) { | ||
const divs = getAllDivs(target); | ||
return { divs }; | ||
}, | ||
test(target, snapshots, consoleCalls) { | ||
const divs = getAllDivs(target); | ||
expect(divs.length).toBe(snapshots.divs.length); | ||
for (let i = 0; i < divs.length; i += 1) { | ||
expect(divs[i]).toBe(snapshots.divs[i]); | ||
} | ||
expect(consoleCalls.warn).toHaveSize(0); | ||
expect(consoleCalls.error).toHaveSize(0); | ||
}, | ||
}; |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
packages/@lwc/integration-karma/test-hydration/attributes/reflective/x/child/child.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,3 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class extends LightningElement {} |
28 changes: 28 additions & 0 deletions
28
packages/@lwc/integration-karma/test-hydration/attributes/reflective/x/main/main.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,28 @@ | ||
<template> | ||
<x-child | ||
accesskey={value.accesskey} | ||
aria-label={value.arialabel} | ||
dir={value.dir} | ||
draggable={value.draggable} | ||
hidden={value.hidden} | ||
id={value.id} | ||
lang={value.lang} | ||
role={value.role} | ||
spellcheck={value.spellcheck} | ||
tabindex={value.tabindex} | ||
title={value.title} | ||
></x-child> | ||
<x-child | ||
accesskey="tata" | ||
aria-label="titi" | ||
dir="auto" | ||
draggable="true" | ||
hidden | ||
id="tutu" | ||
lang="jp" | ||
role="scrollbar" | ||
spellcheck="false" | ||
tabindex="0" | ||
title="tete" | ||
></x-child> | ||
</template> |
File renamed without changes.
14 changes: 11 additions & 3 deletions
14
packages/@lwc/integration-karma/test/component/LightningElement.shadowRoot/index.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 |
---|---|---|
@@ -1,17 +1,25 @@ | ||
import { createElement } from 'lwc'; | ||
import XTest from 'x/test'; | ||
import Basic from 'x/basic'; | ||
import Correct from 'x/correct'; | ||
|
||
it('should always return null when accessing shadowRoot property from within the component', () => { | ||
const el = createElement('x-test', { is: XTest }); | ||
const el = createElement('x-basic', { is: Basic }); | ||
document.body.appendChild(el); | ||
|
||
expect(el.getShadowRoot()).toBe(null); | ||
}); | ||
|
||
it('should be able to access the shadowRoot property from outside the component', () => { | ||
const el = createElement('x-test', { is: XTest }); | ||
const el = createElement('x-basic', { is: Basic }); | ||
document.body.appendChild(el); | ||
|
||
expect(el.shadowRoot).not.toBe(null); | ||
expect(el.shadowRoot).toBeInstanceOf(ShadowRoot); | ||
}); | ||
|
||
it('uses the correct shadow root - W-17441501', () => { | ||
const el = createElement('x-correct', { is: Correct }); | ||
document.body.appendChild(el); | ||
|
||
expect(el.shadowRoot.textContent).toBe(''); | ||
}); |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
.../@lwc/integration-karma/test/component/LightningElement.shadowRoot/x/correct/correct.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> | ||
Hello, world! | ||
</template> |
9 changes: 9 additions & 0 deletions
9
...es/@lwc/integration-karma/test/component/LightningElement.shadowRoot/x/correct/correct.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,9 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class extends LightningElement { | ||
@api | ||
get shadowRoot() { | ||
return (this._shadowRoot = | ||
this._shadowRoot || document.body.appendChild(document.createElement('p'))); | ||
} | ||
} |
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
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
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