'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('featured box renders a playable video preview and a video-cover button', () => { const featured = read('templates/parts/submit/featured.php'); assert.match(featured, /class="new-dplayer dplayer-scale-height"/); assert.match(featured, /video-url="<\?php echo esc_url\(\(string\) \(\$data\['url'\] \?\? ''\)\); \?>"/); assert.match(featured, /video-pic="<\?php echo esc_url\(\(string\) \(\$data\['pic'\] \?\? ''\)\); \?>"/); assert.match(featured, /fa fas fa-play-circle/); // The video-cover button is capability-gated like the video button. assert.match(featured, /if \(\$can_video\) : \?>\s*\n\s*