UI修改
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import {linkShared} from './helpers/shared-modules.mjs';
|
||||
import {routingModuleUrl} from './helpers/routing.mjs';
|
||||
import {test} from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
@@ -7,7 +8,7 @@ import ts from 'typescript';
|
||||
async function moduleUrl(file,replace=code=>code){
|
||||
const filename=new URL(file,import.meta.url);
|
||||
const {outputText}=ts.transpileModule(await readFile(filename,'utf8'),{compilerOptions:{target:ts.ScriptTarget.ES2022,module:ts.ModuleKind.ESNext}});
|
||||
return 'data:text/javascript;base64,'+Buffer.from(replace(outputText).replace(/(['"])\.\.\/routing\1/g,JSON.stringify(routingModuleUrl))+'\n//# sourceURL='+filename.pathname).toString('base64');
|
||||
return 'data:text/javascript;base64,'+Buffer.from(linkShared(replace(outputText)).replace(/(['"])\.\.\/routing\1/g,JSON.stringify(routingModuleUrl))+'\n//# sourceURL='+filename.pathname).toString('base64');
|
||||
}
|
||||
const protocolUrl=await moduleUrl('../src/lib/api/protocol.ts');
|
||||
const renderUrl=await moduleUrl('../src/lib/client/render.ts',code=>code.replace('"../api/protocol"',JSON.stringify(protocolUrl)));
|
||||
@@ -103,10 +104,10 @@ test('search suggestions open the returned drama while hot keywords open search
|
||||
for(const value of [null,{},[null]])assert.ok(searchSuggestionsMarkup(value,'词').includes('暂无搜索建议'));
|
||||
});
|
||||
|
||||
test('dropdown recommendations keep compact cards, real detail links and tracking without full-page metadata',()=>{
|
||||
test('dropdown recommendations keep compact cards and real detail links without analytics or full-page metadata',()=>{
|
||||
const html=searchPicksMarkup([null,...Array.from({length:4},(_,index)=>({...drama,id:7+index,slug:'story-'+index,isNew:true,desc:'简介 <script>',countLike:99}))]);
|
||||
assert.equal((html.match(/class="search-pick"/g)||[]).length,3);
|
||||
assert.ok(html.includes('href="/detail/story-0/"'));assert.ok(html.includes('data-track-item data-item-id="7"'));
|
||||
assert.ok(html.includes('href="/detail/story-0/"'));assert.ok(!html.includes('data-track'));
|
||||
assert.ok(html.includes('class="search-pick-cover"'));assert.ok(html.includes('width="160" height="240"'));
|
||||
assert.ok(html.includes('data-src="https://cdn.example/encrypted.webp"'));assert.ok(html.includes('alt="SEO 标题封面"'));
|
||||
assert.ok(html.includes('简介 <script>'));assert.ok(html.includes('cover-corner-badge--new'));assert.ok(html.includes('>上新</span>'));assert.ok(html.includes('12集'));
|
||||
|
||||
Reference in New Issue
Block a user