Resume offline preparation on launch and show cache readiness

This commit is contained in:
Jonathan Sykes
2026-10-09 09:33:23 +08:00
parent 0251720fa2
commit 009a155568
6 changed files with 63 additions and 8 deletions

View File

@@ -84,3 +84,14 @@ test('classic chunk registry proxies use window.YT and keep the executed singlet
const singleton=root.YT.TestApi;await root.Lazy.load('feature:test');
assert.equal(root.YT.TestApi,singleton);assert.equal(inserted.length,2);
});
test('online launches request worker completion even with Save-Data and skip offline messages',async()=>{
const f=fixture(),sent=[];
const active={postMessage:m=>sent.push(m)},waiting={postMessage:m=>sent.push(m)};
f.root.navigator.connection={saveData:true};f.root.navigator.onLine=true;
f.root.navigator.serviceWorker={ready:Promise.resolve({active,waiting})};
f.root.Lazy.warm();await Promise.resolve();
assert.deepEqual(sent.map(m=>m.type),['COMPLETE_ASSETS','COMPLETE_ASSETS']);
f.root.navigator.onLine=false;f.root.Lazy.warm();await Promise.resolve();assert.equal(sent.length,2);
});