Skip to content

Instantly share code, notes, and snippets.

@YonatanKra

YonatanKra/test.js

Created Nov 15, 2020
Embed
What would you like to do?
list performance test
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
You can’t perform that action at this time.