test: track retained imagery thumbnail intent

This commit is contained in:
Kevin Rajan committed 2026-09-29 13:38:39 -05:00
1 parent 60bf311f90
commit ee8848e81f
1 file changed
+9 -1
+9 -1
View File
@@ -275,6 +275,7 @@ export function fakeThumbnails() {
const requested = [];
/** Direct `request` calls: `[key, priority]`. */
const requests = [];
const retained = [];
const ask = (key) => {
if (!requested.includes(key)) requested.push(key);
};
@@ -282,6 +283,7 @@ export function fakeThumbnails() {
calls,
requested,
requests,
retained,
requestOrdered(candidates, box, window) {
calls.push(['ordered', candidates.map((c) => c.key), window]);
const { focusIndex, firstVisible, lastVisible, extra } = window;
@@ -291,12 +293,18 @@ export function fakeThumbnails() {
lastVisible,
candidates.length,
extra,
).forEach((index) => ask(candidates[index].key));
);
const keys = order.map((index) => candidates[index].key);
keys.forEach(ask);
return keys;
},
request(candidate, box, priority) {
ask(candidate.key);
requests.push([candidate.key, priority]);
},
retain(keys) {
retained.push([...keys]);
},
/** Settle every requested key still unknown, as the loader would. */
probeRequested(status = 'present') {
for (const key of requested)