Skip to content

Commit bea7d26

Browse files
Merge branch 'trunk' into reintroduce-client-side-media
2 parents 9842837 + 6ddfc9d commit bea7d26

9 files changed

Lines changed: 304 additions & 190 deletions

File tree

.github/workflows/reusable-javascript-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Install npm Dependencies
5656
run: npm ci
5757

58-
# Older branches using outdated versions of Puppeteer fail on newer versions of the `ubuntu-24` image.
58+
# Branches prior to 6.1 using outdated versions of Puppeteer fail on newer versions of the `ubuntu-24` image.
5959
# This disables AppArmor in order to work around those failures.
6060
#
6161
# See https://issues.chromium.org/issues/373753919

Gruntfile.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ module.exports = function(grunt) {
115115
'cssmin',
116116
'imagemin',
117117
'jshint',
118-
'qunit',
119118
'uglify',
120119
'watch'
121120
],
@@ -957,7 +956,8 @@ module.exports = function(grunt) {
957956
src: [
958957
'tests/qunit/**/*.js',
959958
'!tests/qunit/vendor/*',
960-
'!tests/qunit/editor/**'
959+
'!tests/qunit/qunit.js',
960+
'!tests/qunit/playwright.config.js'
961961
],
962962
options: grunt.file.readJSON( 'tests/qunit/.jshintrc' )
963963
},
@@ -1061,12 +1061,6 @@ module.exports = function(grunt) {
10611061
}
10621062
}
10631063
},
1064-
qunit: {
1065-
files: [
1066-
'tests/qunit/**/*.html',
1067-
'!tests/qunit/editor/**'
1068-
]
1069-
},
10701064
phpunit: {
10711065
'default': {
10721066
args: ['--verbose', '-c', 'phpunit.xml.dist']
@@ -1599,8 +1593,7 @@ module.exports = function(grunt) {
15991593
},
16001594
test: {
16011595
files: [
1602-
'tests/qunit/**',
1603-
'!tests/qunit/editor/**'
1596+
'tests/qunit/**'
16041597
],
16051598
tasks: ['qunit']
16061599
}
@@ -2222,6 +2215,20 @@ module.exports = function(grunt) {
22222215
}, this.async());
22232216
});
22242217

2218+
grunt.registerTask( 'qunit', 'Runs QUnit tests.', function() {
2219+
var done = this.async();
2220+
grunt.util.spawn( {
2221+
cmd: 'npx',
2222+
args: [ 'playwright', 'test', '--config', 'tests/qunit/playwright.config.js' ],
2223+
opts: { stdio: 'inherit' }
2224+
}, function( error, result, code ) {
2225+
if ( code !== 0 ) {
2226+
grunt.fail.warn( 'QUnit tests failed.' );
2227+
}
2228+
done();
2229+
} );
2230+
} );
2231+
22252232
grunt.registerTask( 'qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.',
22262233
['build', 'copy:qunit', 'qunit']
22272234
);

package-lock.json

Lines changed: 0 additions & 172 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"grunt-contrib-cssmin": "~5.0.0",
5454
"grunt-contrib-imagemin": "~4.0.0",
5555
"grunt-contrib-jshint": "3.2.0",
56-
"grunt-contrib-qunit": "~10.1.1",
5756
"grunt-contrib-uglify": "~5.2.2",
5857
"grunt-contrib-watch": "~1.1.0",
5958
"grunt-file-append": "0.0.7",

src/wp-includes/formatting.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5898,7 +5898,7 @@ function wp_enqueue_emoji_styles() {
58985898
*
58995899
* @since 4.2.0
59005900
*/
5901-
function print_emoji_detection_script() {
5901+
function print_emoji_detection_script(): void {
59025902
static $printed = false;
59035903

59045904
if ( $printed ) {
@@ -5907,10 +5907,18 @@ function print_emoji_detection_script() {
59075907

59085908
$printed = true;
59095909

5910-
if ( did_action( 'wp_print_footer_scripts' ) ) {
5911-
_print_emoji_detection_script();
5910+
if ( is_admin() ) {
5911+
if ( did_action( 'admin_print_footer_scripts' ) ) {
5912+
_print_emoji_detection_script();
5913+
} else {
5914+
add_action( 'admin_print_footer_scripts', '_print_emoji_detection_script' );
5915+
}
59125916
} else {
5913-
add_action( 'wp_print_footer_scripts', '_print_emoji_detection_script' );
5917+
if ( did_action( 'wp_print_footer_scripts' ) ) {
5918+
_print_emoji_detection_script();
5919+
} else {
5920+
add_action( 'wp_print_footer_scripts', '_print_emoji_detection_script' );
5921+
}
59145922
}
59155923
}
59165924

tests/phpunit/includes/utils.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,17 @@ function dmp_filter( $a ) {
432432
return $a;
433433
}
434434

435-
function get_echo( $callback, $args = array() ) {
435+
/**
436+
* Gets the output buffer for invoking the provided callback.
437+
*
438+
* @param callable $callback Callback.
439+
* @param mixed[] $args Arguments.
440+
* @return string Captured output.
441+
*/
442+
function get_echo( callable $callback, array $args = array() ): string {
436443
ob_start();
437444
call_user_func_array( $callback, $args );
438-
return ob_get_clean();
445+
return (string) ob_get_clean();
439446
}
440447

441448
// Recursively generate some quick assertEquals() tests based on an array.

0 commit comments

Comments
 (0)