fix(admin): improve native link manager filters

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-05 22:19:50 +08:00
1 parent b124795d84
commit 7faa2d53d8
3 files changed
+98

No files matched your search

@@ -0,0 +1,23 @@
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)
})