-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add flag to disable synthetic shadow (#4408)
- Loading branch information
1 parent
4ba6b1e
commit c6c6803
Showing
6 changed files
with
46 additions
and
3 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
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
31 changes: 31 additions & 0 deletions
31
packages/@lwc/integration-karma/test/synthetic-shadow/disable-synthetic-shadow/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,31 @@ | ||
import { createElement, setFeatureFlagForTest } from 'lwc'; | ||
import { IS_SYNTHETIC_SHADOW_LOADED, isSyntheticShadowRootInstance } from 'test-utils'; | ||
import Component from 'x/component'; | ||
|
||
if (IS_SYNTHETIC_SHADOW_LOADED && !process.env.FORCE_NATIVE_SHADOW_MODE_FOR_TEST) { | ||
describe('DISABLE_SYNTHETIC_SHADOW', () => { | ||
describe('flag disabled', () => { | ||
it('renders synthetic shadow', () => { | ||
const elm = createElement('x-component', { is: Component }); | ||
document.body.appendChild(elm); | ||
expect(isSyntheticShadowRootInstance(elm.shadowRoot)).toBe(true); | ||
}); | ||
}); | ||
|
||
describe('flag enabled', () => { | ||
beforeEach(() => { | ||
setFeatureFlagForTest('DISABLE_SYNTHETIC_SHADOW', true); | ||
}); | ||
|
||
afterEach(() => { | ||
setFeatureFlagForTest('DISABLE_SYNTHETIC_SHADOW', false); | ||
}); | ||
|
||
it('renders native shadow', () => { | ||
const elm = createElement('x-component', { is: Component }); | ||
document.body.appendChild(elm); | ||
expect(isSyntheticShadowRootInstance(elm.shadowRoot)).toBe(false); | ||
}); | ||
}); | ||
}); | ||
} |
3 changes: 3 additions & 0 deletions
3
...integration-karma/test/synthetic-shadow/disable-synthetic-shadow/x/component/component.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 {} |
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