整体UI修改

This commit is contained in:
谢宇宁
2026-10-27 17:39:27 +07:00
parent 8cdbfee08f
commit e289658a28
99 changed files with 1227 additions and 4118 deletions
+5 -5
View File
@@ -15,9 +15,9 @@ const {ads,promotionRow,renderHome,activeBanners,hero,card,topicCard,imageAttrib
const drama={id:23456,title:'正常剧集 <script>alert(1)</script>',cover:'https://example.com/poster.webp',tagNames:['都市']};
const advert={id:'ad-one',title:'有效广告',images:'https://example.com/ad.webp',link:'https://example.com/landing'};
test('topic cards include escaped metadata for content exposure and click tracking',()=>{
test('topic cards escape their names and carry no tracking attributes',()=>{
const html=topicCard({id:7,name:'都市 <甜宠>',icon:'https://example.com/topic.png'});
assert.match(html,/data-track-item data-item-id="7" data-item-type="topic" data-item-name="都市 &lt;甜宠&gt;"/);
assert.ok(html.includes('<h3>都市 &lt;甜宠&gt;</h3>')||html.includes('都市 &lt;甜宠&gt;'));assert.doesNotMatch(html,/data-track|data-item-/);
});
test('API images use data sources and local placeholders until decrypted, including video posters',()=>{
@@ -43,8 +43,8 @@ test('shared square ad rows keep real ad data and links and omit empty placement
const html=promotionRow([advert,{...advert,id:'ad-two',title:'第二个广告'}]);
assert.ok(html.includes('class="promo-marquee" data-promotion-row'));
assert.equal((html.match(/class="promo-tile"/g)||[]).length,2);
assert.ok(html.includes('data-ad-id="ad-one"'));assert.ok(html.includes('data-ad-id="ad-two"'));
assert.ok(html.includes('href="https://example.com/landing"'));assert.ok(html.includes('data-ad-type="icon"'));
assert.equal((html.match(/data-ad href=/g)||[]).length,2);assert.doesNotMatch(html,/data-track|data-ad-/);
assert.ok(html.includes('href="https://example.com/landing"'));
assert.ok(html.includes('width="132" height="132"'));assert.ok(html.includes('alt="有效广告"'));
for(const value of [null,{},[],[null]])assert.equal(promotionRow(value),'');
});
@@ -77,7 +77,7 @@ test('dynamic home sections share a grid without inheriting the prototype editor
for(const id of [31,32,34])assert.ok(html.includes(`href="/config/${id}/"`));
for(const id of [23456,2,3])assert.ok(html.includes(`href="/detail/${id}/"`));
assert.ok(!html.includes('href="/video/4/"'));assert.ok(!html.includes('href="/config/33/"'));assert.ok(html.includes('href="/topics/8/"'));
assert.equal((html.match(/class="drama-episodes"/g)||[]).length,1);
assert.equal((html.match(/class="hg-card-eps"/g)||[]).length,1);
assert.ok(html.indexOf('必看好剧')<html.indexOf('热播榜'));
});