mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 17:22:19 +00:00
test: track retained imagery thumbnail intent
This commit is contained in:
1 parent
60bf311f90
commit
ee8848e81f
1 file changed
+9
-1
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user