Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
24 lines
1.2 KiB
JavaScript
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)
|
|
})
|