@@ -95,6 +95,7 @@ public function test_has_transparency_metadata( string $image_path, array $expec
95
95
*/
96
96
public function test_dominant_color_has_transparency ( string $ image_path , array $ expected_color , bool $ expected_transparency ): void {
97
97
$ this ->skip_if_mime_type_unsupported ( $ image_path );
98
+
98
99
// Test when metadata is not an array.
99
100
$ invalid_meta_attachment = self ::factory ()->attachment ->create (
100
101
array (
@@ -439,14 +440,13 @@ public function test_dominant_color_add_inline_style(): void {
439
440
dominant_color_add_inline_style ();
440
441
441
442
// Verify the style was registered.
442
- global $ wp_styles ;
443
- $ this ->assertTrue ( isset ( $ wp_styles ->registered ['dominant-color-styles ' ] ) );
443
+ $ this ->assertTrue ( wp_style_is ( 'dominant-color-styles ' , 'registered ' ) );
444
444
445
445
// Verify the style was enqueued.
446
446
$ this ->assertTrue ( wp_style_is ( 'dominant-color-styles ' , 'enqueued ' ) );
447
447
448
448
// Verify the inline style was added.
449
- $ inline_styles = $ wp_styles ->get_data ( 'dominant-color-styles ' , 'after ' );
449
+ $ inline_styles = wp_styles () ->get_data ( 'dominant-color-styles ' , 'after ' );
450
450
$ this ->assertNotEmpty ( $ inline_styles );
451
451
$ this ->assertStringContainsString (
452
452
'img[data-dominant-color]:not(.has-transparency) { background-color: var(--dominant-color); } ' ,
@@ -461,14 +461,13 @@ public function test_dominant_color_admin_inline_style(): void {
461
461
dominant_color_admin_inline_style ();
462
462
463
463
// Verify the style was registered.
464
- global $ wp_styles ;
465
- $ this ->assertTrue ( isset ( $ wp_styles ->registered ['dominant-color-admin-styles ' ] ) );
464
+ $ this ->assertTrue ( wp_style_is ( 'dominant-color-admin-styles ' , 'registered ' ) );
466
465
467
466
// Verify the style was enqueued.
468
467
$ this ->assertTrue ( wp_style_is ( 'dominant-color-admin-styles ' , 'enqueued ' ) );
469
468
470
469
// Verify the inline style was added.
471
- $ inline_styles = $ wp_styles ->get_data ( 'dominant-color-admin-styles ' , 'after ' );
470
+ $ inline_styles = wp_styles () ->get_data ( 'dominant-color-admin-styles ' , 'after ' );
472
471
$ this ->assertNotEmpty ( $ inline_styles );
473
472
$ this ->assertStringContainsString (
474
473
'.wp-core-ui .attachment-preview[data-dominant-color]:not(.has-transparency) { background-color: var(--dominant-color); } ' ,
@@ -480,7 +479,6 @@ public function test_dominant_color_admin_inline_style(): void {
480
479
* @covers ::dominant_color_admin_script
481
480
*/
482
481
public function test_dominant_color_admin_script (): void {
483
-
484
482
$ output = get_echo ( 'dominant_color_admin_script ' );
485
483
486
484
// Verify if script tag exists.
0 commit comments