对小工具进行了一些修复

This commit is contained in:
2026-08-26 11:06:05 +08:00
parent c6b1acfe0e
commit 523af723ae
12 changed files with 433 additions and 37 deletions
@@ -42,6 +42,47 @@ test('icon card widgets expose Zibll vertical and horizontal contracts', () => {
assert.match(helper, /wp_kses_post\(\$desc\)/);
});
test('button group uses the complete Zibll schema, DOM and responsive sizing contract', () => {
const schema = read('src/WidgetSystem/WidgetSchemas.php');
const renderer = read('src/WidgetSystem/Renderers/GeneralRenderer.php');
const css = read('assets/widgets/frontend.css');
for (const field of ['obs_animation', 'animation_repeat', 'pc_width', 'm_width', 'pc_padding', 'm_padding', 'pc_gap', 'm_gap', "'id' => 'align'", "'id' => 'radius'", "'id' => 'hollow'", 'go_link', 'icon_left', 'icon_right']) {
assert.match(schema, new RegExp(field.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
}
for (const token of ['widget-buttons mb20 pc-size-', 'm-size-', 'widget-buttons-wrap flex hh align-', 'class="ml6"', 'obs-animate ani-']) {
assert.match(renderer, new RegExp(token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
}
assert.doesNotMatch(renderer, /aksrt-widget-buttons/);
assert.match(schema, /'id' => 'text'[^\n]+allow_html/);
assert.match(renderer, /wp_kses_post\(\(string\) \$item\['text'\]\)/);
assert.match(css, /\.widget-buttons\.pc-size-large \.but\s*\{\s*padding:\s*12px 24px/);
assert.match(css, /\.widget-buttons\.m-size-medium \.but\s*\{\s*padding:\s*8px 16px/);
});
test('vertical notice uses Zibll sources, searchable forum fields and swiper sizing', () => {
const schema = read('src/WidgetSystem/WidgetSchemas.php');
const renderer = read('src/WidgetSystem/Renderers/GeneralRenderer.php');
const form = read('src/WidgetSystem/FormRenderer.php');
const css = read('assets/widgets/frontend.css');
for (const field of ["'id' => 'blank'", "'id' => 'radius'", "'id' => 'interval'", "'id' => 'color'", "'id' => 'source'", 'msg_icon', "'id' => 'count'", 'desc_s', 'forums_opts', 'posts_opts', 'img_ids']) {
assert.match(schema, new RegExp(field.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
}
for (const field of ['plate', 'plate_exclude', 'topic', 'tag']) {
assert.match(schema, new RegExp(`'id' => '${field}', 'type' => 'select'[^\n]+multiple`));
}
assert.match(form, /aksrt-widget-remote-select/);
for (const token of ['swiper-bulletin mb20 ', 'notice-slide', 'new-swiper', 'data-direction="vertical"', 'data-loop="true"', 'data-autoplay="1"', 'bulletin-icon flex jc shrink0']) {
assert.match(renderer, new RegExp(token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
}
assert.doesNotMatch(renderer, /aksrt-widget-notice/);
assert.match(schema, /'id' => 'title'[^\n]+allow_html/);
assert.match(renderer, /wp_html_excerpt\([^\n]+160, '\.\.\.'/);
assert.match(renderer, /str_starts_with\(\$icon, 'customsvg-'\)/);
assert.match(css, /\.swiper-bulletin \.new-swiper\s*\{[^}]*height:\s*2\.4em/s);
assert.match(css, /\.swiper-bulletin \.new-swiper\s*\{[^}]*line-height:\s*2\.4em/s);
assert.match(css, /\.bulletin-icon\s*\{[^}]*width:\s*26px[^}]*height:\s*26px[^}]*font-size:\s*18px/s);
});
test('admin core supports composite dependencies and nested repeater renumbering', () => {
const core = require(path.join(root, 'assets/widgets/admin-core.js'));
assert.equal(core.dependencyVisible([['direction', '!=', 'vertical'], ['scale_height', '!=', '']], { direction: 'horizontal', scale_height: '1' }), true);