Created
November 15, 2020 08:32
-
-
Save YonatanKra/12dd835dd168013c956bef8e98c12f5b to your computer and use it in GitHub Desktop.
list performance test
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
suite('performance issue', () => { | |
test( | |
'removing a list should not call layout more than once', async () => { | |
let count = 0; | |
const originalLayout = List.prototype.layout; | |
List.prototype.layout = function(update) { | |
originalLayout.call(this, update); | |
count++; | |
}; | |
const itemsTemplates = new Array(100).fill(0).map(() => listItem()); | |
fixt = await fixture(listTemplate({items: itemsTemplates})); | |
element = fixt.root.querySelector('mwc-list')!; | |
count = 0; | |
fixt.remove(); | |
await element.updateComplete; | |
fixt = null; | |
assert.equal( | |
count, | |
1, | |
'list.layout ran more than once while it shouldn\'t have'); | |
List.prototype.layout = originalLayout; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment