-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix(engine): issues #1199 and #1198 when disconnecting * fix(engine): PR 1202 feedback * fix(engine): undefined elm needs protection * fix(engine): adding tests for PR 1202 * fix(engine): test fix for native shadow
- Loading branch information
Showing
13 changed files
with
196 additions
and
17 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
36 changes: 36 additions & 0 deletions
36
packages/integration-karma/test/component/disconnect-callback/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,36 @@ | ||
import { createElement } from 'test-utils'; | ||
|
||
import Container from 'x/container'; | ||
|
||
function resetTimingBuffer() { | ||
window.timingBuffer = []; | ||
} | ||
|
||
beforeEach(() => { | ||
resetTimingBuffer(); | ||
}); | ||
|
||
afterEach(() => { | ||
delete window.timingBuffer; | ||
}); | ||
|
||
it('should disconnect on the right order (issue #1199 and #1198)', () => { | ||
const elm = createElement('x-container', { is: Container }); | ||
document.body.appendChild(elm); | ||
expect(window.timingBuffer.length).toEqual(15); | ||
|
||
resetTimingBuffer(); | ||
elm.hide = true; | ||
|
||
return Promise.resolve().then(() => { | ||
expect(window.timingBuffer).toEqual([ | ||
'parent:disconnectedCallback', | ||
'ownChild:disconnectedCallback', | ||
'grandChild:disconnectedCallback', | ||
'adoptedChild:disconnectedCallback', | ||
'grandChild:disconnectedCallback', | ||
]); | ||
|
||
resetTimingBuffer(); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...ges/integration-karma/test/component/disconnect-callback/x/adoptedChild/adoptedChild.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> | ||
<x-grand-child></x-grand-child> | ||
</template> |
20 changes: 20 additions & 0 deletions
20
packages/integration-karma/test/component/disconnect-callback/x/adoptedChild/adoptedChild.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,20 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class AdoptedChild extends LightningElement { | ||
constructor() { | ||
super(); | ||
window.timingBuffer.push('adoptedChild:constructor'); | ||
} | ||
|
||
connectedCallback() { | ||
window.timingBuffer.push('adoptedChild:connectedCallback'); | ||
} | ||
|
||
disconnectedCallback() { | ||
window.timingBuffer.push('adoptedChild:disconnectedCallback'); | ||
} | ||
|
||
renderedCallback() { | ||
window.timingBuffer.push('adoptedChild:renderedCallback'); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/integration-karma/test/component/disconnect-callback/x/container/container.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,7 @@ | ||
<template> | ||
<template if:false={hide}> | ||
<x-parent> | ||
<x-adopted-child></x-adopted-child> | ||
</x-parent> | ||
</template> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
packages/integration-karma/test/component/disconnect-callback/x/container/container.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 Container extends LightningElement { | ||
@api hide = false; | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/integration-karma/test/component/disconnect-callback/x/grandChild/grandChild.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,2 @@ | ||
<template></template> | ||
|
20 changes: 20 additions & 0 deletions
20
packages/integration-karma/test/component/disconnect-callback/x/grandChild/grandChild.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,20 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class GrandChild extends LightningElement { | ||
constructor() { | ||
super(); | ||
window.timingBuffer.push('grandChild:constructor'); | ||
} | ||
|
||
connectedCallback() { | ||
window.timingBuffer.push('grandChild:connectedCallback'); | ||
} | ||
|
||
disconnectedCallback() { | ||
window.timingBuffer.push('grandChild:disconnectedCallback'); | ||
} | ||
|
||
renderedCallback() { | ||
window.timingBuffer.push('grandChild:renderedCallback'); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/integration-karma/test/component/disconnect-callback/x/ownChild/ownChild.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> | ||
<x-grand-child></x-grand-child> | ||
</template> |
20 changes: 20 additions & 0 deletions
20
packages/integration-karma/test/component/disconnect-callback/x/ownChild/ownChild.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,20 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class OwnChild extends LightningElement { | ||
constructor() { | ||
super(); | ||
window.timingBuffer.push('ownChild:constructor'); | ||
} | ||
|
||
connectedCallback() { | ||
window.timingBuffer.push('ownChild:connectedCallback'); | ||
} | ||
|
||
disconnectedCallback() { | ||
window.timingBuffer.push('ownChild:disconnectedCallback'); | ||
} | ||
|
||
renderedCallback() { | ||
window.timingBuffer.push('ownChild:renderedCallback'); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/integration-karma/test/component/disconnect-callback/x/parent/parent.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,5 @@ | ||
<template> | ||
<x-own-child></x-own-child> | ||
<slot></slot> | ||
</template> | ||
|
20 changes: 20 additions & 0 deletions
20
packages/integration-karma/test/component/disconnect-callback/x/parent/parent.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,20 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Parent extends LightningElement { | ||
constructor() { | ||
super(); | ||
window.timingBuffer.push('parent:constructor'); | ||
} | ||
|
||
connectedCallback() { | ||
window.timingBuffer.push('parent:connectedCallback'); | ||
} | ||
|
||
disconnectedCallback() { | ||
window.timingBuffer.push('parent:disconnectedCallback'); | ||
} | ||
|
||
renderedCallback() { | ||
window.timingBuffer.push('parent:renderedCallback'); | ||
} | ||
} |