修复了一些问题

This commit is contained in:
2026-08-25 19:59:43 +08:00
parent f5746da0ae
commit c484ee6ef3
5 changed files with 16 additions and 87 deletions
@@ -21,19 +21,16 @@ test('published post content reaches the front submit editor unchanged', () => {
const editor = read('templates/parts/submit/editor-main.php');
assert.match(context, /\$current_content\s*=\s*\$edit_post\s*\?\s*\$edit_post->post_content\s*:\s*'';/);
assert.match(editor, /\$initial_content\s*=\s*\(string\) \$ctx\['current_content'\]/);
assert.match(editor, /wp_editor\(\$initial_content, 'post_content', \$editor_settings\);/);
assert.match(editor, /wp_editor\(\(string\) \$ctx\['current_content'\], 'post_content', \$editor_settings\);/);
});
test('front submit restores published content when TinyMCE initializes empty', () => {
const editor = read('templates/parts/submit/editor-main.php');
const runtime = read('assets/js/front-submit.js');
const styles = read('assets/css/frontend/pages/submit.css');
test('front submit uses the WordPress registered jQuery runtime', () => {
const source = read('src/Core/ScriptsPart1b.php');
assert.match(editor, /'quicktags'\s*=>\s*true/);
assert.match(editor, /id="aksrt-initial-post-content"/);
assert.match(runtime, /hydrateEditor:\s*function/);
assert.match(runtime, /editor\.setContent\(initialContent\)/);
assert.match(runtime, /switchEditors\.go\('post_content', 'html'\)/);
assert.match(styles, /textarea\.wp-editor-area\s*\{[^}]*opacity:\s*1/s);
assert.match(source, /wp_enqueue_script\('jquery'\);/);
assert.match(source, /registered\['jquery'\]->deps\s*=\s*\['jquery-core'\]/);
assert.doesNotMatch(source, /wp_deregister_script\('jquery'\)/);
assert.doesNotMatch(source, /wp_register_script\(\s*'jquery'/);
assert.doesNotMatch(source, /jquery-migrate/);
assert.doesNotMatch(source, /runtime\/libs\/jquery\.min\.js|['"]1\.9\.1['"]/);
});