Fix followed page thumbnail scaling

This commit is contained in:
2026-05-27 14:49:00 +08:00
parent ea532949c0
commit faec1140e7
2 changed files with 37 additions and 62 deletions

View File

@@ -89,6 +89,11 @@ assert.match(
/data-tm-thumb-scale-following-list="1"[\s\S]*--tm-thumb-following-list-width/,
"followed-cams list should be separated from homepage list sizing",
);
assert.match(
capturedCss,
/data-tm-thumb-scale-following-list="1"[\s\S]*grid-template-columns:\s*repeat\(auto-fill,\s*minmax\(var\(--tm-thumb-following-list-width\),\s*1fr\)\)\s*!important/,
"followed-cams list should keep the site's stretching grid alignment while using detected minimum width",
);
assert.match(
capturedCss,
/#main\.roomPage\s+ul\.list:has\(li\.roomCard\)\s+\.room_thumbnail_container[\s\S]*width:\s*var\(--tm-thumb-related-thumb-width\)\s*!important[\s\S]*height:\s*var\(--tm-thumb-related-height\)\s*!important/,
@@ -251,8 +256,8 @@ const cacheFakeDocument = {
addEventListener() {},
};
const cacheStore = new Map([
["tm-thumb-scale:size-cache:v7", JSON.stringify({
schema: 7,
["tm-thumb-scale:size-cache:v9", JSON.stringify({
schema: 9,
scale: 2,
cardHeightScale: 1.55,
modules: {
@@ -345,17 +350,15 @@ vm.runInNewContext(source, {
localStorage: {
getItem() {
return JSON.stringify({
schema: 7,
schema: 9,
scale: 2,
cardHeightScale: 1.55,
modules: {
home: {
homeCard: { width: 174, height: 120 },
homeThumb: { width: 174, height: 98 },
},
followingList: {
followingListCard: { width: 190, height: 120 },
followingListThumb: { width: 188, height: 106 },
},
},
});
@@ -382,7 +385,7 @@ vm.runInNewContext(source, {
assert.equal(followingAttrs.get("data-tm-thumb-scale-following-list"), "1", "followed-cams should use its own cached list module");
assert.equal(followingAttrs.get("data-tm-thumb-scale-home"), undefined, "followed-cams should not apply homepage cache");
assert.equal(followingVars.get("--tm-thumb-following-list-width"), "380px");
assert.equal(followingVars.get("--tm-thumb-following-list-card-height"), "186px");
assert.equal(followingVars.get("--tm-thumb-following-list-thumb-width"), "376px");
assert.equal(followingVars.get("--tm-thumb-following-list-thumb-height"), "212px");
assert.equal(followingVars.get("--tm-thumb-following-list-card-height"), undefined);
assert.equal(followingVars.get("--tm-thumb-following-list-thumb-width"), undefined);
assert.equal(followingVars.get("--tm-thumb-following-list-thumb-height"), undefined);
assert.equal(followingVars.get("--tm-thumb-home-width"), undefined);