fix(widgets): align slider media combo with the Zibll reference

- 渲染器:幻灯片按参考补回 span/a 包裹、lazyload swiper-lazy 懒加载契约、
  视频背景与图层视差属性条件;组合模块补回 is_show 门控、超管缺省提示、
  widget-graphic-cover mb 类与内层样式容器、卡片列入场动画类与 lazy_cover 开关
- Schema:幻灯片/图层/卡片字段补齐 library、unit、参考描述文案与分组按钮标题
- 后台表单:分组按钮文案(添加幻灯片/添加卡片/添加图层)、行编号格式、
  视频上传不渲染图片预览(FormRenderer + admin.js)
- 契约测试:新增 slider media combo 前后台参考契约断言

验证:php -l 全部通过;run.php 133 断言;node --test 243 项(仅主干既有
toast-contract 失败);validate-widget-golden 通过
This commit is contained in:
2026-09-05 14:17:03 +08:00
parent cf264d5e81
commit 65a69b1dec
5 changed files with 181 additions and 74 deletions
@@ -97,3 +97,29 @@ test('admin core supports composite dependencies and nested repeater renumbering
assert.equal(core.dependencyVisible(['image|free_size', '!=|!=', '|'], { image: 'x', free_size: '1' }), true);
assert.equal(core.replaceRepeaterIndexes('widget[3][0][1]', [4, 2]), 'widget[3][4][2]');
});
test('slider media combo replicates the reference module front and back', () => {
const renderer = read('src/WidgetSystem/Renderers/SliderRenderer.php');
const schema = read('src/WidgetSystem/WidgetSchemas.php');
const form = read('src/WidgetSystem/FormRenderer.php');
// 后台表单:参考主题分组按钮文案与上传字段库约束。
for (const token of ["'button_title' => '添加幻灯片'", "'button_title' => '添加卡片'", "'button_title' => '添加图层'", "'library' => 'image'", "'library' => 'video'", 'PC端布局配置', '移动端布局方式', '左侧幻灯片', '右侧图文视频卡片', '卡片样式配置']) {
assert.match(schema, new RegExp(token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
}
assert.match(form, /\$field\['button_title'\]/);
assert.match(form, /\$library !== 'video'/);
// 前端:幻灯片 span/a 包裹、懒加载契约、视频背景与图层视差。
for (const token of ["'<span>' . $body . '</span>'", 'lazyload swiper-lazy', 'slide-background-video', "aksrt_is_lazy('lazy_sider')", 'data-swiper-parallax-opacity', 'data-swiper-parallax-scale']) {
assert.match(renderer, new RegExp(token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
}
assert.doesNotMatch(renderer, /playsinline/);
// 组合模块:is_show 门控、管理端缺省提示、卡片列动画与比例变量。
for (const token of ["aksrt_is_lazy('lazy_cover')", 'alert alert-warning', '当前模块下没有可显示的幻灯片', 'obs-animate ani-', "widget-graphic-cover ' . ($is_row ? 'mb10' : 'mb20')", 'row gutters-5', 'col-xs-', 'graphic-text this-font', 'm-cover-ratio', 'cover-ratio', 'layout-ratio', 'data-row=', 'data-col=', "m-' . sanitize_html_class($m_layout_type)"]) {
assert.match(renderer, new RegExp(token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
}
// 参考主题 is_show:两侧均为空时不输出占位。
assert.doesNotMatch(renderer, /请配置幻灯片或卡片|empty_state/);
});