Files
wordpress-theme-aksrt/tests/widget-system/link-manager-admin-contract.test.cjs
T
2026-11-05 22:19:50 +08:00

24 lines
1.2 KiB
JavaScript

const test = require('node:test')
const assert = require('node:assert/strict')
const fs = require('node:fs')
const path = require('node:path')
const root = path.resolve(__dirname, '..', '..')
const read = (file) => fs.readFileSync(path.join(root, file), 'utf8')
test('native link manager explains an empty category filter and keeps visibility sorting inline', () => {
const manager = read('src/Admin/LinkManager.php')
const css = read('assets/css/admin/links-manager.css')
assert.match(manager, /add_action\('admin_enqueue_scripts', \[self::class, 'enqueue_assets'\]\)/)
assert.match(manager, /add_filter\('get_terms_args', \[self::class, 'show_empty_categories'/)
assert.match(manager, /add_filter\('wp_dropdown_cats', \[self::class, 'render_empty_category_option'/)
assert.match(manager, /\$args\['hide_empty'\] = false/)
assert.match(manager, /暂无链接分类/)
assert.match(manager, /\$hook !== 'link-manager\.php'/)
assert.match(css, /\.wp-list-table th\.column-visible\s*\{[^}]*min-width:\s*170px/s)
assert.match(css, /\.wp-list-table th\.column-visible a\s*\{[^}]*white-space:\s*nowrap/s)
assert.match(css, /\.sorting-indicators\s*\{[^}]*display:\s*grid/s)
})