'use strict'; const assert = require('node:assert/strict'); const fs = require('node:fs'); const path = require('node:path'); const test = require('node:test'); const root = path.resolve(__dirname, '..', '..'); const read = (file) => fs.readFileSync(path.join(root, file), 'utf8'); test('nested comment children ol resets list markers and UA indent', () => { // wp_list_comments(style=ol) 输出的
    不带 .list-unstyled, // 全局 reset(main.css)又只覆盖 ul;缺重置时二级评论前会回潮出 // ol 默认的 "1." 序号与 40px 缩进。 const layout = read('assets/css/frontend/comments/layout.css'); const childrenBlock = layout.match(/#postcomments \.children \{[^}]*\}/); assert.ok(childrenBlock, 'layout.css must have a #postcomments .children rule'); assert.ok(/list-style:\s*none/.test(childrenBlock[0]), 'children ol must reset list-style (no "1." markers)'); assert.ok(/padding-left:\s*0/.test(childrenBlock[0]), 'children ol must reset UA 40px indent'); // 页面实际加载 comments.min.css,产物必须同步携带该重置。 const built = read('assets/css/build/comments.min.css'); assert.ok( /#postcomments \.children\{[^}]*list-style:none/, 'built comments.min.css must carry the children list reset' ); });