Skip to content

Commit 9db65fc

Browse files
committed
Add assertions to test_amp_get_content_sanitizers_with_dev_mode
1 parent 399f9b5 commit 9db65fc

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
@@ -784,7 +784,10 @@ function ( $xpaths ) use ( $element_xpaths ) {
784784
// Check that AMP_Dev_Mode_Sanitizer is registered once in dev mode, and now also with admin bar showing.
785785
add_filter( 'amp_dev_mode_enabled', '__return_true' );
786786
add_filter( 'show_admin_bar', '__return_true' );
787-
$sanitizers = amp_get_content_sanitizers();
787+
wp_localize_script( 'admin-bar', 'myAdminBarStrings', [ 'hello' => 'world' ] );
788+
wp_scripts()->done[] = 'admin-bar';
789+
wp_styles()->done[] = 'admin-bar';
790+
$sanitizers = amp_get_content_sanitizers();
788791
$this->assertTrue( is_admin_bar_showing() );
789792
$this->assertTrue( amp_is_dev_mode() );
790793
$this->assertArrayHasKey( 'AMP_Dev_Mode_Sanitizer', $sanitizers );
@@ -794,6 +797,8 @@ function ( $xpaths ) use ( $element_xpaths ) {
794797
[
795798
'//*[ @id = "wpadminbar" ]',
796799
'//*[ @id = "wpadminbar" ]//*',
800+
'//script[ not( @src ) ][ contains( text(), "var myAdminBarStrings =" ) ]',
801+
'//style[ @id = "admin-bar-inline-css" ]',
797802
]
798803
),
799804
$sanitizers['AMP_Dev_Mode_Sanitizer']['element_xpaths']

0 commit comments

Comments
 (0)