对小工具进行了一些修复

This commit is contained in:
2026-08-26 11:17:22 +08:00
parent 523af723ae
commit 9ad6f41592
9 changed files with 17 additions and 223 deletions
@@ -8,7 +8,7 @@ const read = (file) => fs.readFileSync(path.join(root, file), 'utf8');
test('modern widget schemas expose Zibll field names and defaults', () => {
const source = read('src/WidgetSystem/WidgetSchemas.php');
for (const field of ['mini_opt', 'paginate', 'tabs', "'id' => 'cat'", "'id' => 'topics'", 'zibpay_type', 'layout_ratio', 'slide_scale', 'm_layout_type', 'm_cover_ratio', 'image_layer', 'image_select']) {
for (const field of ['mini_opt', 'paginate', 'tabs', "'id' => 'cat'", "'id' => 'topics'", 'layout_ratio', 'slide_scale', 'm_layout_type', 'm_cover_ratio', 'image_layer', 'image_select']) {
assert.match(source, new RegExp(field.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
}
assert.match(source, /'热门推荐'.*'orderby' => 'views'/s);
@@ -59,18 +59,22 @@ test('button group uses the complete Zibll schema, DOM and responsive sizing con
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', () => {
test('vertical notice supports only custom and article sources with Zibll swiper sizing', () => {
const schema = read('src/WidgetSystem/WidgetSchemas.php');
const renderer = read('src/WidgetSystem/Renderers/GeneralRenderer.php');
const postQuery = read('src/WidgetSystem/PostQuery.php');
const form = read('src/WidgetSystem/FormRenderer.php');
const controller = read('src/WidgetSystem/AdminFormController.php');
const adminJs = read('assets/widgets/admin.js');
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']) {
for (const field of ["'id' => 'blank'", "'id' => 'radius'", "'id' => 'interval'", "'id' => 'color'", "'id' => 'source'", 'msg_icon', "'id' => 'count'", 'desc_s', '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/);
assert.match(schema, /'options' => \['' => '自定义', 'posts' => '文章'\]/);
assert.doesNotMatch(schema, /forums_opts|notice_forum_fields|zibpay_type|zibpay_price|zibpay_points_price|sales_volume/);
assert.doesNotMatch(renderer, /zib_bbs_get_posts_query|forums_opts/);
assert.doesNotMatch(postQuery, /zibpay_type|zibpay_price|zibpay_points_price|sales_volume/);
assert.doesNotMatch(form + controller + adminJs, /aksrt_widget_remote_options|aksrt-widget-remote-select|aksrt-widget-remote-picker/);
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, '\\$&')));
}