UI修改
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import {linkShared} from './helpers/shared-modules.mjs';
|
||||
import {test} from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {readFile} from 'node:fs/promises';
|
||||
@@ -10,7 +11,7 @@ async function moduleUrl(path,imports={}){
|
||||
const {outputText}=ts.transpileModule(await readFile(new URL('../src/lib/'+path,import.meta.url),'utf8'),{compilerOptions:{target:ts.ScriptTarget.ES2022,module:ts.ModuleKind.ESNext}});
|
||||
let code=outputText;
|
||||
for(const [key,url] of Object.entries({'../routing':routingModuleUrl,...imports}))for(const quote of ["'",'"'])code=code.replace(quote+key+quote,JSON.stringify(url));
|
||||
return 'data:text/javascript;base64,'+Buffer.from(code).toString('base64');
|
||||
return 'data:text/javascript;base64,'+Buffer.from(linkShared(code)).toString('base64');
|
||||
}
|
||||
const protocol=await moduleUrl('api/protocol.ts');
|
||||
const renderUrl=await moduleUrl('client/render.ts',{'../api/protocol':protocol});
|
||||
@@ -26,6 +27,7 @@ test('slug-first paths encode one segment once, preserve ID fallback and accept
|
||||
const path=routes.contentPath(kind,{id:9,slug:' '+key+' '});
|
||||
assert.equal(path,`/${kind}/${encodeURIComponent(key)}/`);
|
||||
assert.equal(routes.parseSitePath(path)[kind==='detail'?'key':'value'],key);
|
||||
if(kind==='detail'){assert.equal(routes.parseSitePath(path+'page/2/'),null);continue;}
|
||||
assert.equal(routes.paginationPath(path,2),path+'page/2/');
|
||||
assert.equal(routes.parseSitePath(path+'page/2/').page,2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user