整体UI修改
This commit is contained in:
@@ -32,11 +32,8 @@ test('clean paths select the matching page, IDs, and navigation section',()=>{
|
||||
assert.deepEqual(parseSitePath('/shorts/'),{group:'page',key:'shorts'});
|
||||
assert.deepEqual(parseSitePath('/topics/31/'),{group:'page',key:'topics',value:'31'});
|
||||
assert.deepEqual(parseSitePath('/play/23456/90001/'),{group:'play',key:'23456',value:'90001'});
|
||||
assert.deepEqual(parseSitePath('/info/deposit/vip/'),{group:'info',key:'deposit',value:'vip'});
|
||||
assert.deepEqual(parseSitePath('/member/history/'),{group:'member',key:'history'});
|
||||
assert.deepEqual(parseSitePath('/member/likes/'),{group:'member',key:'likes'});
|
||||
assert.deepEqual(parseSitePath('/member/likes/page/2/'),{group:'member',key:'likes',page:2});
|
||||
for(const [path,section] of [['/','home'],['/shorts/','shorts'],['/topics/31/','topics'],['/detail/7/','shorts'],['/member/center/','']]){
|
||||
for(const path of ['/info/deposit/','/info/deposit/vip/','/info/user-center/','/info/settings/','/info/feedback/','/member/center/','/member/history/','/member/likes/page/2/'])assert.equal(parseSitePath(path),null,path);
|
||||
for(const [path,section] of [['/','home'],['/shorts/','shorts'],['/topics/31/','topics'],['/detail/7/','shorts'],['/info/about-us/','']]){
|
||||
assert.equal(navigationSection(parseSitePath(path)),section,path);
|
||||
}
|
||||
});
|
||||
@@ -86,9 +83,10 @@ test('hash page links are not converted or treated as page destinations',()=>{
|
||||
test('only recognized internal page destinations are handled by the application',()=>{
|
||||
const base='https://drama.example/detail/7';
|
||||
assert.equal(internalPagePath('/shorts/',base),'/shorts/');
|
||||
assert.equal(internalPagePath('https://drama.example/member/history/',base),'/member/history/');
|
||||
assert.equal(internalPagePath('https://drama.example/rank/new/',base),'/rank/new/');
|
||||
assert.equal(internalPagePath('https://drama.example/member/history/',base),null);
|
||||
assert.equal(internalPagePath('/search/'+encodeURIComponent('爱情 / 逆袭')+'/',base),'/search/'+encodeURIComponent('爱情 / 逆袭')+'/');
|
||||
for(const href of ['https://external.example/shorts','javascript:alert(1)','/api/app/playlet/home','/assets/poster.webp','#comments','/unknown','/play/7/','/shorts/extra/','/member/unknown/','/detail/0/']){
|
||||
for(const href of ['https://external.example/shorts','javascript:alert(1)','/api/app/playlet/home','/assets/poster.webp','#comments','/unknown','/play/7/','/shorts/extra/','/member/history/','/detail/0/']){
|
||||
assert.equal(internalPagePath(href,base),null,href);
|
||||
}
|
||||
});
|
||||
@@ -99,8 +97,8 @@ test('page navigation requests a complete server document while leaving hashes,
|
||||
try{
|
||||
for(const path of ['#comments','/#page/shorts','https://external.example/shorts','/series/'])navigateTo(path);
|
||||
assert.deepEqual(calls,[]);
|
||||
for(const path of ['/play/23456/90001/','/member/history/','/rank/new/','/shorts/page/2/?sort=2'])navigateTo(path);
|
||||
assert.deepEqual(calls,['/play/23456/90001/','/member/history/','/rank/new/','/shorts/page/2/?sort=2']);
|
||||
for(const path of ['/play/23456/90001/','/info/about-us/','/rank/new/','/shorts/page/2/?sort=2'])navigateTo(path);
|
||||
assert.deepEqual(calls,['/play/23456/90001/','/info/about-us/','/rank/new/','/shorts/page/2/?sort=2']);
|
||||
assert.equal(globalThis.window.location.href,'https://drama.example/shorts/','the old document stays visible until the new response arrives');
|
||||
}finally{globalThis.window=previous;}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user