mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editor: Restore the merging of TinyMCE settings in `wp_tinymce_inline…
…_scripts()`. This ensures that the function applies the `wp_editor_settings` filter and merges the resulting array with the rest of TinyMCE init settings. Includes a unit test to verify that the settings are merged correctly after adding the assignment of `array_merge()` result that was missed in the initial commit. Follow-up to [44265], [59033]. Props kkmuffme, akshat2802, davidbaumwald, SergeyBiryukov. Fixes #61754. git-svn-id: https://develop.svn.wordpress.org/trunk@59074 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information
1 parent
35907da
commit 1eb5f61
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* @group editor | ||
* | ||
* @covers ::wp_tinymce_inline_scripts | ||
*/ | ||
class Tests_Editor_wpTinyMceInlineScripts extends WP_UnitTestCase { | ||
|
||
/** | ||
* Tests that the function applies the `wp_editor_settings` filter | ||
* and merges the resulting array with the rest of TinyMCE init settings. | ||
* | ||
* @ticket 61754 | ||
*/ | ||
public function test_wp_tinymce_inline_scripts_array_merge() { | ||
$merged_settings = array(); | ||
|
||
add_filter( | ||
'wp_editor_settings', | ||
static function ( $settings ) { | ||
$settings['tinymce'] = array( 'wp_autoresize_on' => true ); | ||
return $settings; | ||
} | ||
); | ||
|
||
add_filter( | ||
'tiny_mce_before_init', | ||
static function ( $tinymce_settings ) use ( &$merged_settings ) { | ||
$merged_settings = $tinymce_settings; | ||
return $tinymce_settings; | ||
} | ||
); | ||
|
||
wp_scripts(); | ||
wp_tinymce_inline_scripts(); | ||
|
||
$this->assertArrayHasKey( 'wp_autoresize_on', $merged_settings ); | ||
} | ||
} |