Skip to content

Commit 6f13702

Browse files
committed
Add assertions to test_amp_get_content_sanitizers_with_dev_mode
1 parent da0c68a commit 6f13702

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/php/test-amp-helper-functions.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,10 @@ function ( $xpaths ) use ( $element_xpaths ) {
780780
// Check that AMP_Dev_Mode_Sanitizer is registered once in dev mode, and now also with admin bar showing.
781781
add_filter( 'amp_dev_mode_enabled', '__return_true' );
782782
add_filter( 'show_admin_bar', '__return_true' );
783-
$sanitizers = amp_get_content_sanitizers();
783+
wp_localize_script( 'admin-bar', 'myAdminBarStrings', [ 'hello' => 'world' ] );
784+
wp_scripts()->done[] = 'admin-bar';
785+
wp_styles()->done[] = 'admin-bar';
786+
$sanitizers = amp_get_content_sanitizers();
784787
$this->assertTrue( is_admin_bar_showing() );
785788
$this->assertTrue( amp_is_dev_mode() );
786789
$this->assertArrayHasKey( 'AMP_Dev_Mode_Sanitizer', $sanitizers );
@@ -790,6 +793,8 @@ function ( $xpaths ) use ( $element_xpaths ) {
790793
[
791794
'//*[ @id = "wpadminbar" ]',
792795
'//*[ @id = "wpadminbar" ]//*',
796+
'//script[ not( @src ) ][ contains( text(), "var myAdminBarStrings =" ) ]',
797+
'//style[ @id = "admin-bar-inline-css" ]',
793798
]
794799
),
795800
$sanitizers['AMP_Dev_Mode_Sanitizer']['element_xpaths']

0 commit comments

Comments
 (0)