fix(single): match the reference video cover height (bare ratio)

Zibll reserves +50px only for covers whose title overlays them
(image/slide via .single-cover/.single-cover-slide); the video cover
keeps its title in the footer below and uses the bare scale height
(.dplayer-scale-height). Drop the +50px from the video box, pin the
reference height matrix in the contract test, and refresh the stale
slide-action assertion in the toast contract.
This commit is contained in:
kate522 committed 2026-09-06 11:12:13 +08:00
1 parent 7c0d5945ca
commit d3eef19b95
3 files changed
+19 -12

No files matched your search

@@ -1,7 +1,9 @@
'use strict';
// 文章详情页顶部封面高度契约:单图 / 多图(轮播) / 视频三种模式
// 必须共用同一高度公式 padding-bottom: calc(比例% + 50px)。
// 文章详情页顶部封面高度契约(对齐参考主题):
// 单图/多图(轮播)封面标题叠加封面,高度 = calc(比例% + 50px)(zibll .single-cover /
// .single-cover-slide);视频封面标题在下方 footer、无叠加,高度 = 裸比例%
// (zibll .dplayer-scale-height)。
const assert = require('node:assert/strict');
const fs = require('node:fs');
@@ -22,17 +24,18 @@ test('single cover: image mode keeps the calc(scale% + 50px) height', () => {
);
});
test('single cover: video mode aligns with the image-mode height formula', () => {
test('single cover: video mode uses the bare ratio height like the reference dplayer box', () => {
assert.match(
singleRender,
/single-cover--video imgbox-container" style="padding-bottom:calc\(<\?php echo esc_attr\(\(string\) \$video_scale\); \?>% \+ 50px\);"/,
'视频封面必须输出 calc(video_scale% + 50px) 内联高度'
/single-cover--video imgbox-container" style="padding-bottom:<\?php echo esc_attr\(\(string\) \$video_scale\); \?>%;"/,
'视频封面必须输出裸 video_scale% 高度(标题在下方 footer,无叠加补偿)'
);
// 不得回退到裸比例高度。
// +50px 是标题叠加封面的补偿量,仅单图/多图封面适用;视频封面
// 对齐参考主题 .dplayer-scale-height,不得继承该公式。
assert.doesNotMatch(
singleRender,
/padding-bottom:<\?php echo esc_attr\(\(string\) \$video_scale\); \?>%;"/,
'视频封面禁止输出不带 +50px 的裸比例高度'
/single-cover--video imgbox-container" style="padding-bottom:calc\(/,
'视频封面禁止输出 +50px 叠加补偿高度'
);
});