fix: WebContentsView
removal should compare directly (#44670)
* fix: WebContentsView removal should compare directly Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fixup view comparision Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: use erase_if Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Apply review suggestions Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
parent
500d453a63
commit
900400e442
3 changed files with 43 additions and 26 deletions
|
@ -101,6 +101,30 @@ describe('WebContentsView', () => {
|
|||
expect(w.contentView.children).to.deep.equal([wcv3, wcv1, wcv2]);
|
||||
});
|
||||
|
||||
it('handle removal and re-addition of children', () => {
|
||||
const w = new BaseWindow({ show: false });
|
||||
const cv = new View();
|
||||
w.setContentView(cv);
|
||||
|
||||
const wcv1 = new WebContentsView();
|
||||
const wcv2 = new WebContentsView();
|
||||
|
||||
expect(w.contentView.children).to.deep.equal([]);
|
||||
|
||||
w.contentView.addChildView(wcv1);
|
||||
w.contentView.addChildView(wcv2);
|
||||
|
||||
expect(w.contentView.children).to.deep.equal([wcv1, wcv2]);
|
||||
|
||||
w.contentView.removeChildView(wcv1);
|
||||
|
||||
expect(w.contentView.children).to.deep.equal([wcv2]);
|
||||
|
||||
w.contentView.addChildView(wcv1);
|
||||
|
||||
expect(w.contentView.children).to.deep.equal([wcv2, wcv1]);
|
||||
});
|
||||
|
||||
function triggerGCByAllocation () {
|
||||
const arr = [];
|
||||
for (let i = 0; i < 1000000; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue