-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate test suites with skipped unit tests to karma (#1753)
* test: remove unit tests related to global attribute restriction restriction was removed via #1362 * test: update error message in scoped-ids.spec.ts * test: update test to match <slot> element spec * test: remove unit test that was testing non-existent functions * test: migrate tests to integration-karma * test: migrate scoped-ids.spec to karma suite * test: migrate html-element.spec.ts to karma * test: migrate traverse.spec.ts to karma suite
- Loading branch information
1 parent
62d28c7
commit c1b56ec
Showing
91 changed files
with
1,065 additions
and
2,775 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1,485 changes: 0 additions & 1,485 deletions
1,485
packages/@lwc/engine/src/framework/__tests__/html-element.spec.ts
This file was deleted.
Oops, something went wrong.
111 changes: 0 additions & 111 deletions
111
packages/@lwc/engine/src/framework/__tests__/scoped-ids.spec.ts
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
1 change: 1 addition & 0 deletions
1
packages/integration-karma/test/component/aom-setter/x/roleTester/roleTester.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 @@ | ||
<template></template> |
12 changes: 12 additions & 0 deletions
12
packages/integration-karma/test/component/aom-setter/x/roleTester/roleTester.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,12 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export let roleSetterCallCount = 0; | ||
export default class MyComponent extends LightningElement { | ||
get role() { | ||
return 'role'; | ||
} | ||
@api | ||
set role(value) { | ||
roleSetterCallCount += 1; | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
.../integration-karma/test/component/decorators/api/x/nullInitialValue/nullInitialValue.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 @@ | ||
<template></template> |
5 changes: 5 additions & 0 deletions
5
...es/integration-karma/test/component/decorators/api/x/nullInitialValue/nullInitialValue.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,5 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
export default class MyComponent extends LightningElement { | ||
@api | ||
foo = null; | ||
} |
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
1 change: 1 addition & 0 deletions
1
...ages/integration-karma/test/component/decorators/track/x/nonObservable/nonObservable.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 @@ | ||
<template></template> |
14 changes: 14 additions & 0 deletions
14
packages/integration-karma/test/component/decorators/track/x/nonObservable/nonObservable.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 @@ | ||
import { LightningElement, track, api } from 'lwc'; | ||
|
||
export default class MyComponent extends LightningElement { | ||
@track | ||
state = {}; | ||
|
||
@api | ||
set foo(value) { | ||
this.state.foo = value; | ||
} | ||
get foo() { | ||
return this.state.foo; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-karma/test/component/decorators/track/x/setTrackedValueToNull/setTrackedValueToNull.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 @@ | ||
<template></template> |
10 changes: 10 additions & 0 deletions
10
...on-karma/test/component/decorators/track/x/setTrackedValueToNull/setTrackedValueToNull.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,10 @@ | ||
import { LightningElement, track } from 'lwc'; | ||
|
||
export default class MyComponent extends LightningElement { | ||
@track | ||
state = {}; | ||
connectedCallback() { | ||
this.state.foo = null; | ||
this.state.foo; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/integration-karma/test/component/lockerIntegration/LockerIntegration.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,11 @@ | ||
import { createElement } from 'lwc'; | ||
|
||
import LockerIntegration from 'x/lockerIntegration'; | ||
|
||
it('should support Locker integration which uses a wrapped LightningElement base class', () => { | ||
const elm = createElement('x-secure-parent', { is: LockerIntegration }); | ||
document.body.appendChild(elm); | ||
// Verifying that shadow tree was created to ensure the component class was successfully processed | ||
const actual = elm.querySelector('div.secure'); | ||
expect(actual).toBeDefined(); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...gration-karma/test/component/lockerIntegration/x/lockerIntegration/lockerIntegration.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 class="secure"></div> | ||
</template> |
15 changes: 15 additions & 0 deletions
15
...tegration-karma/test/component/lockerIntegration/x/lockerIntegration/lockerIntegration.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 @@ | ||
import { LightningElement } from 'lwc'; | ||
import Template from './lockerIntegration.html'; | ||
function SecureBase() { | ||
if (this instanceof SecureBase) { | ||
LightningElement.prototype.constructor.call(this); | ||
} else { | ||
return LightningElement; | ||
} | ||
} | ||
SecureBase.__circular__ = true; | ||
export default class Foo extends SecureBase { | ||
render() { | ||
return Template; | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
packages/integration-karma/test/shadow-dom/Element-properties/Element.assignedSlot.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,79 @@ | ||
import { createElement } from 'lwc'; | ||
import { getHostChildNodes } from 'test-utils'; | ||
|
||
import SimpleParent from 'x/simpleParent'; | ||
import SlottedParent from 'x/slotted'; | ||
import SlottedCustomElement from 'x/slottedCustomElement'; | ||
import SlotReceiver from 'x/slot'; | ||
import CustomElementAsDefaultSlot from 'x/customElementAsDefaultSlot'; | ||
import TextSlotted from 'x/textSlotted'; | ||
|
||
describe('assignedSlot', () => { | ||
it('should return null when custom element is not in slot', () => { | ||
const elm = createElement('x-assigned-slot', { is: SimpleParent }); | ||
document.body.appendChild(elm); | ||
const child = elm.shadowRoot.querySelector('x-no-slot'); | ||
expect(child.assignedSlot).toBe(null); | ||
}); | ||
|
||
it('should return null when native element is not in slot', () => { | ||
const elm = createElement('x-assigned-slot', { is: SimpleParent }); | ||
document.body.appendChild(elm); | ||
const child = elm.shadowRoot.querySelector('div'); | ||
expect(child.assignedSlot).toBe(null); | ||
}); | ||
|
||
it('should return the correct slot when native element is slotted', () => { | ||
const elm = createElement('x-native-slotted-component', { is: SlottedParent }); | ||
document.body.appendChild(elm); | ||
const slot = elm.shadowRoot.querySelector('x-slot').shadowRoot.querySelector('slot'); | ||
const child = elm.shadowRoot.querySelector('div'); | ||
expect(child.assignedSlot).toBe(slot); | ||
}); | ||
|
||
it('should return the correct slot when custom element is slotted', () => { | ||
const elm = createElement('x-custom-slotted-component', { is: SlottedCustomElement }); | ||
document.body.appendChild(elm); | ||
const slot = elm.shadowRoot.querySelector('x-slot').shadowRoot.querySelector('slot'); | ||
const child = elm.shadowRoot.querySelector('x-child'); | ||
expect(child.assignedSlot).toBe(slot); | ||
}); | ||
|
||
it('should return the correct named slot when native element is slotted', () => { | ||
const elm = createElement('x-native-slotted-component', { is: SlottedParent }); | ||
document.body.appendChild(elm); | ||
const slot = elm.shadowRoot.querySelector('x-named-slot').shadowRoot.querySelector('slot'); | ||
const child = elm.shadowRoot.querySelector('div.named'); | ||
expect(child.assignedSlot).toBe(slot); | ||
}); | ||
|
||
it('should return the correct named slot when custom element is slotted', () => { | ||
const elm = createElement('x-custom-slotted-component', { is: SlottedCustomElement }); | ||
document.body.appendChild(elm); | ||
const slot = elm.shadowRoot.querySelector('x-named-slot').shadowRoot.querySelector('slot'); | ||
const child = elm.shadowRoot.querySelector('x-child.named'); | ||
expect(child.assignedSlot).toBe(slot); | ||
}); | ||
|
||
it('should return null when native element default slot content', () => { | ||
const elm = createElement('x-assigned-slot', { is: SlotReceiver }); | ||
document.body.appendChild(elm); | ||
const child = elm.shadowRoot.querySelector('div'); | ||
expect(child.assignedSlot).toBe(null); | ||
}); | ||
|
||
it('should return null when custom element default slot content', () => { | ||
const elm = createElement('x-assigned-slot', { is: CustomElementAsDefaultSlot }); | ||
document.body.appendChild(elm); | ||
const child = elm.shadowRoot.querySelector('x-child'); | ||
expect(child.assignedSlot).toBe(null); | ||
}); | ||
|
||
it('should return the correct slot when text is slotted', () => { | ||
const elm = createElement('x-native-slotted-component', { is: TextSlotted }); | ||
document.body.appendChild(elm); | ||
const slot = elm.shadowRoot.querySelector('x-slot').shadowRoot.querySelector('slot'); | ||
const text = getHostChildNodes(elm.shadowRoot.querySelector('x-slot'))[0]; | ||
expect(text.assignedSlot).toBe(slot); | ||
}); | ||
}); |
Oops, something went wrong.