1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Desktop,Mobile: Fixes #11065: Improve performance when there are many selected items (#11067)

This commit is contained in:
Henry Heino
2024-09-21 04:53:16 -07:00
committed by GitHub
parent 5beb80bf61
commit 0965c6d257
6 changed files with 42 additions and 5 deletions

View File

@@ -0,0 +1,31 @@
import BaseModel from './BaseModel';
describe('BaseModel', () => {
test.each([
[0, 0],
[4, 10],
[10, 4],
[5, 5],
])('should filter items by IDs (itemCount: %d, idCount: %d)', (itemCount, idCount) => {
const items = [];
const ids = [];
const expectedMatchingItems = [];
for (let i = 0; i < idCount; i++) {
const id = `matching-${i}`;
ids.push(id);
if (items.length < itemCount) {
const item = { id };
items.push(item);
expectedMatchingItems.push(item);
}
}
while (items.length < itemCount) {
items.push({ id: `non-matching-${items.length}` });
}
expect(BaseModel.modelsByIds(items, ids)).toMatchObject(expectedMatchingItems);
});
});