Skip to content

Commit

Permalink
Add assertions to test_amp_get_content_sanitizers_with_dev_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Dec 20, 2019
1 parent da0c68a commit 6f13702
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/php/test-amp-helper-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,10 @@ function ( $xpaths ) use ( $element_xpaths ) {
// Check that AMP_Dev_Mode_Sanitizer is registered once in dev mode, and now also with admin bar showing.
add_filter( 'amp_dev_mode_enabled', '__return_true' );
add_filter( 'show_admin_bar', '__return_true' );
$sanitizers = amp_get_content_sanitizers();
wp_localize_script( 'admin-bar', 'myAdminBarStrings', [ 'hello' => 'world' ] );
wp_scripts()->done[] = 'admin-bar';
wp_styles()->done[] = 'admin-bar';
$sanitizers = amp_get_content_sanitizers();
$this->assertTrue( is_admin_bar_showing() );
$this->assertTrue( amp_is_dev_mode() );
$this->assertArrayHasKey( 'AMP_Dev_Mode_Sanitizer', $sanitizers );
Expand All @@ -790,6 +793,8 @@ function ( $xpaths ) use ( $element_xpaths ) {
[
'//*[ @id = "wpadminbar" ]',
'//*[ @id = "wpadminbar" ]//*',
'//script[ not( @src ) ][ contains( text(), "var myAdminBarStrings =" ) ]',
'//style[ @id = "admin-bar-inline-css" ]',
]
),
$sanitizers['AMP_Dev_Mode_Sanitizer']['element_xpaths']
Expand Down

0 comments on commit 6f13702

Please sign in to comment.