Skip to content

Commit

Permalink
Address CR feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
nfmohit committed Jul 18, 2024
1 parent c5df344 commit 2c59948
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions includes/Modules/Reader_Revenue_Manager/Tag_Matchers.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class Tag_Matchers extends Module_Tag_Matchers implements Tag_Matchers_Interface
*/
public function regex_matchers() {
return array(
"/<script\\s+[^>]*src=['|\"]https?:\\/\\/news\\.google\\.com\\/swg\\/js\\/v1\\/swg-basic\\.js['|\"][^>]*>",
'/\\(self\\.SWG_BASIC=self\\.SWG_BASIC\\|\\|\\[\\]\\)\\.push/',
"/<script\s+[^>]*src=['|\"]https?:\/\/news\.google\.com\/swg\/js\/v1\/swg-basic\.js['|\"][^>]*>/",
'/\(self\.SWG_BASIC=self\.SWG_BASIC\|\|\[\]\)\.push/',
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function test_register() {
$footer_html = $this->capture_action( 'wp_footer' );

$this->assertStringContainsString( 'Google Reader Revenue Manager snippet added by Site Kit', $footer_html );
$this->assertStringContainsString( 'script type="text/javascript" src="https://news.google.com/swg/js/v1/swg-basic.js" id="google_swgjs-js"></script>', $footer_html );
$this->assertStringContainsString( '<script type="text/javascript" src="https://news.google.com/swg/js/v1/swg-basic.js" id="google_swgjs-js"></script>', $footer_html ); // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
$this->assertStringContainsString( '(self.SWG_BASIC=self.SWG_BASIC||[]).push(basicSubscriptions=>{basicSubscriptions.init({"type":"NewsArticle","isPartOfType":["Product"],"isPartOfProductId":"' . self::PUBLICATION_ID . ':openaccess","clientOptions":{"theme":"light","lang":"en-US"}});});', $footer_html );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function test_template_redirect() {
$footer_html = $this->capture_action( 'wp_footer' );

$this->assertStringContainsString( 'Google Reader Revenue Manager snippet added by Site Kit', $footer_html );
$this->assertStringContainsString( 'script type="text/javascript" src="https://news.google.com/swg/js/v1/swg-basic.js" id="google_swgjs-js"></script>', $footer_html );
$this->assertStringContainsString( '<script type="text/javascript" src="https://news.google.com/swg/js/v1/swg-basic.js" id="google_swgjs-js"></script>', $footer_html ); // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
$this->assertStringContainsString( '(self.SWG_BASIC=self.SWG_BASIC||[]).push(basicSubscriptions=>{basicSubscriptions.init({"type":"NewsArticle","isPartOfType":["Product"],"isPartOfProductId":"' . $publication_id . ':openaccess","clientOptions":{"theme":"light","lang":"en-US"}});});', $footer_html );
}

Expand Down

0 comments on commit 2c59948

Please sign in to comment.