29 lines
3.9 KiB
JavaScript
29 lines
3.9 KiB
JavaScript
|
|
'use strict';
|
||
|
|
const {assert,functionSource,app,css,html,read,vm,buildMeta}=require('./helpers/app-source');
|
||
|
|
const packageVersion=JSON.parse(read('package.json')).version;
|
||
|
|
assert(packageVersion===buildMeta.PACKAGE_VERSION&&buildMeta.APP_VERSION==='47.83','v47.83 canonical version marker is missing');
|
||
|
|
|
||
|
|
const bindBoard=functionSource('bindBoard');
|
||
|
|
assert(bindBoard.includes('const release=(paintCurrent=false)=>{')&&bindBoard.includes('cancelBoardDragFrame(b);clearDragRender(b);hidePickupHandleOverlay()'),'Pointer release does not synchronously stop the drag scheduler and remove the pickup overlay');
|
||
|
|
assert(functionSource('hidePickupHandleOverlay').includes("removeProperty('transform')"),'Pickup overlay retains its released compositor position');
|
||
|
|
|
||
|
|
const pickupDesign=functionSource('syncPickupHandleDesign'),pickupUpdate=functionSource('updatePickupHandleOverlay');
|
||
|
|
assert(pickupDesign.includes("classList.toggle('custom-cursor',Boolean(item))")&&pickupDesign.includes("classList.toggle('flag-cursor',Boolean(item?.flagAsset))")&&pickupDesign.includes('pickupHandleOverlay.replaceChildren(image)')&&pickupUpdate.includes('syncPickupHandleDesign()'),'Pickup overlay does not mirror the selected emoji/flag cursor');
|
||
|
|
assert(css.includes('#pickupHandleOverlay.custom-cursor.visible{display:grid}')&&css.includes('#pickupHandleOverlay.custom-cursor.flag-cursor img'),'Custom cursor pickup overlay CSS is missing');
|
||
|
|
assert(functionSource('syncCursorAppearance').includes('syncPickupHandleDesign()'),'Changing cursor style does not refresh the pickup appearance');
|
||
|
|
|
||
|
|
const merge=functionSource('mergeSnapshotIntoData');
|
||
|
|
assert(merge.includes('authoritativeCompatibleStateIds=authoritativeWorld?new Set():null')&&merge.includes('retainLocalSolve=compatible&¤t?.solved===true&&incoming?.solved!==true')&&merge.includes("if(retainLocalSolve)noteCloudRow('state',id)")&&merge.includes('merged=compatible?mergeBoardStates(current,incoming):deepClone(incoming)')&&!merge.includes('current?.solved&&!incoming.solved?deepClone(incoming)'),'Authoritative pull can still downgrade a compatible local clear or reuse a clear across replaced board geometry');
|
||
|
|
const completion=functionSource('checkSolvedAndExpand');
|
||
|
|
const cloudFailure=completion.slice(completion.indexOf('const published=await pushCloudPending()'),completion.indexOf('let durableMeta='));
|
||
|
|
assert(completion.includes('writeDirtyRecoveryJournal();')&&cloudFailure.includes("toast('クリアは端末に保存しました。共有反映は自動で再試行します。')")&&cloudFailure.includes('armCloudPush(1000)')&&!cloudFailure.includes('data.states[b.id]=previous.state'),'Completion is not checkpointed immediately or is still rolled back on a transient cloud failure');
|
||
|
|
|
||
|
|
const overlay={dataset:{},classList:{values:new Set(),toggle(name,on){on?this.values.add(name):this.values.delete(name)}},replaceChildren(node){this.child=node;this.textContent=''},textContent:'',style:{}};
|
||
|
|
const cursorItems=new Map([['emoji-test',{cursorStyle:'emoji-test',cursorEmoji:'🙂'}]]);
|
||
|
|
const context={pickupHandleOverlay:overlay,data:{cursorStyle:'emoji-test'},cursorModel:{item:style=>cursorItems.get(style)||null},document:{createElement(){return{src:'',alt:'',draggable:true}}}};
|
||
|
|
vm.createContext(context);vm.runInContext(`${functionSource('activeCustomCursorItem')}\n${pickupDesign}\nthis.syncPickupHandleDesign=syncPickupHandleDesign;`,context);
|
||
|
|
assert(context.syncPickupHandleDesign()===true&&overlay.textContent==='🙂'&&overlay.classList.values.has('custom-cursor')&&!overlay.classList.values.has('flag-cursor'),'Emoji cursor was not applied to the pickup overlay');
|
||
|
|
context.data.cursorStyle='flag-test';cursorItems.set('flag-test',{cursorStyle:'flag-test',flagAsset:'flag.svg'});context.syncPickupHandleDesign();
|
||
|
|
assert(overlay.child?.src==='flag.svg'&&overlay.classList.values.has('flag-cursor'),'Flag cursor was not applied to the pickup overlay');
|
||
|
|
|
||
|
|
console.log('v47.83 pickup release, durable completion, and cursor-design regression test passed');
|