Skip to content

Commit f3c49b6

Browse files
committed
Update test cases for paired browsing amp dev mode scripts
1 parent 9da142c commit f3c49b6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/php/src/Admin/PairedBrowsingTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,23 @@ public function test_init_frontend_client() {
162162

163163
// Check that init_client() was called.
164164
$this->assertEquals( 102, has_action( 'admin_bar_menu', [ $this->instance, 'add_admin_bar_menu_item' ] ) );
165+
166+
// Check if all required scripts has been enqueued.
165167
$this->assertTrue( wp_script_is( 'amp-paired-browsing-client' ) );
168+
$this->assertTrue( wp_script_is( 'wp-dom-ready' ) );
169+
$this->assertTrue( wp_script_is( 'wp-polyfill' ) );
170+
$this->assertTrue( wp_script_is( 'wp-polyfill-inert' ) );
171+
$this->assertTrue( wp_script_is( 'regenerator-runtime' ) );
172+
166173
$printed_scripts = get_echo( 'wp_print_scripts' );
167174
$this->assertStringContainsString( DevMode::DEV_MODE_ATTRIBUTE, $printed_scripts );
168175
$this->assertStringContainsString( 'ampPairedBrowsingClientData', $printed_scripts );
169176
$this->assertStringContainsString( 'isAmpDocument', $printed_scripts );
170177
$this->assertStringContainsString( 'amp-paired-browsing-client.js', $printed_scripts );
178+
$this->assertStringContainsString( 'dom-ready.js', $printed_scripts );
179+
$this->assertStringContainsString( 'wp-polyfill.js', $printed_scripts );
180+
$this->assertStringContainsString( 'wp-polyfill-inert.js', $printed_scripts );
181+
$this->assertStringContainsString( 'regenerator-runtime.js', $printed_scripts );
171182

172183
// Check that init_app() was not called.
173184
$this->assertFalse( has_action( 'template_redirect', [ $this->instance, 'ensure_app_location' ] ) );

0 commit comments

Comments
 (0)