Script Loader: Properly adjust tests missed in [38443].
See #37800. git-svn-id: https://develop.svn.wordpress.org/trunk@38447 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2fc4e48d07
commit
19b838af8b
|
@ -31,7 +31,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_should_have_defaults_on_frontend() {
|
function test_should_have_defaults_on_frontend() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//s.w.org'>\n";
|
$expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";
|
||||||
|
|
||||||
$this->expectOutputString( $expected );
|
$this->expectOutputString( $expected );
|
||||||
|
|
||||||
|
@ -39,10 +39,10 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_dns_prefetching() {
|
function test_dns_prefetching() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" .
|
$expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
|
||||||
"<link rel='dns-prefetch' href='//wordpress.org'>\n" .
|
"<link rel='dns-prefetch' href='//wordpress.org' />\n" .
|
||||||
"<link rel='dns-prefetch' href='//google.com'>\n" .
|
"<link rel='dns-prefetch' href='//google.com' />\n" .
|
||||||
"<link rel='dns-prefetch' href='//make.wordpress.org'>\n";
|
"<link rel='dns-prefetch' href='//make.wordpress.org' />\n";
|
||||||
|
|
||||||
add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_domains' ), 10, 2 );
|
add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_domains' ), 10, 2 );
|
||||||
|
|
||||||
|
@ -70,11 +70,11 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
* @ticket 37652
|
* @ticket 37652
|
||||||
*/
|
*/
|
||||||
function test_preconnect() {
|
function test_preconnect() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" .
|
$expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
|
||||||
"<link rel='preconnect' href='//wordpress.org'>\n" .
|
"<link rel='preconnect' href='//wordpress.org' />\n" .
|
||||||
"<link rel='preconnect' href='https://make.wordpress.org'>\n" .
|
"<link rel='preconnect' href='https://make.wordpress.org' />\n" .
|
||||||
"<link rel='preconnect' href='http://google.com'>\n" .
|
"<link rel='preconnect' href='http://google.com' />\n" .
|
||||||
"<link rel='preconnect' href='http://w.org'>\n";
|
"<link rel='preconnect' href='http://w.org' />\n";
|
||||||
|
|
||||||
add_filter( 'wp_resource_hints', array( $this, '_add_preconnect_domains' ), 10, 2 );
|
add_filter( 'wp_resource_hints', array( $this, '_add_preconnect_domains' ), 10, 2 );
|
||||||
|
|
||||||
|
@ -98,10 +98,10 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_prerender() {
|
function test_prerender() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" .
|
$expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
|
||||||
"<link rel='prerender' href='https://make.wordpress.org/great-again'>\n" .
|
"<link rel='prerender' href='https://make.wordpress.org/great-again' />\n" .
|
||||||
"<link rel='prerender' href='http://jobs.wordpress.net'>\n" .
|
"<link rel='prerender' href='http://jobs.wordpress.net' />\n" .
|
||||||
"<link rel='prerender' href='//core.trac.wordpress.org'>\n";
|
"<link rel='prerender' href='//core.trac.wordpress.org' />\n";
|
||||||
|
|
||||||
add_filter( 'wp_resource_hints', array( $this, '_add_prerender_urls' ), 10, 2 );
|
add_filter( 'wp_resource_hints', array( $this, '_add_prerender_urls' ), 10, 2 );
|
||||||
|
|
||||||
|
@ -124,8 +124,8 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_parse_url_dns_prefetch() {
|
function test_parse_url_dns_prefetch() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" .
|
$expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
|
||||||
"<link rel='dns-prefetch' href='//make.wordpress.org'>\n";
|
"<link rel='dns-prefetch' href='//make.wordpress.org' />\n";
|
||||||
|
|
||||||
add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_long_urls' ), 10, 2 );
|
add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_long_urls' ), 10, 2 );
|
||||||
|
|
||||||
|
@ -145,8 +145,8 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_dns_prefetch_styles() {
|
function test_dns_prefetch_styles() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" .
|
$expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n" .
|
||||||
"<link rel='dns-prefetch' href='//s.w.org'>\n";
|
"<link rel='dns-prefetch' href='//s.w.org' />\n";
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'family' => 'Open+Sans:400',
|
'family' => 'Open+Sans:400',
|
||||||
|
@ -164,8 +164,8 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_dns_prefetch_scripts() {
|
function test_dns_prefetch_scripts() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" .
|
$expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n" .
|
||||||
"<link rel='dns-prefetch' href='//s.w.org'>\n";
|
"<link rel='dns-prefetch' href='//s.w.org' />\n";
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'family' => 'Open+Sans:400',
|
'family' => 'Open+Sans:400',
|
||||||
|
@ -182,8 +182,8 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_dns_prefetch_scripts_does_not_included_registered_only() {
|
function test_dns_prefetch_scripts_does_not_included_registered_only() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//s.w.org'>\n";
|
$expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";
|
||||||
$unexpected = "<link rel='dns-prefetch' href='//wordpress.org'>\n";
|
$unexpected = "<link rel='dns-prefetch' href='//wordpress.org' />\n";
|
||||||
|
|
||||||
wp_register_script( 'jquery-elsewhere', 'https://wordpress.org/wp-includes/js/jquery/jquery.js' );
|
wp_register_script( 'jquery-elsewhere', 'https://wordpress.org/wp-includes/js/jquery/jquery.js' );
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
* @ticket 37502
|
* @ticket 37502
|
||||||
*/
|
*/
|
||||||
function test_deregistered_scripts_are_ignored() {
|
function test_deregistered_scripts_are_ignored() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//s.w.org'>\n";
|
$expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";
|
||||||
|
|
||||||
wp_enqueue_script( 'test-script', 'http://example.org/script.js' );
|
wp_enqueue_script( 'test-script', 'http://example.org/script.js' );
|
||||||
wp_deregister_script( 'test-script' );
|
wp_deregister_script( 'test-script' );
|
||||||
|
@ -212,7 +212,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
|
||||||
* @ticket 37652
|
* @ticket 37652
|
||||||
*/
|
*/
|
||||||
function test_malformed_urls() {
|
function test_malformed_urls() {
|
||||||
$expected = "<link rel='dns-prefetch' href='//s.w.org'>\n";
|
$expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";
|
||||||
|
|
||||||
// Errant colon.
|
// Errant colon.
|
||||||
add_filter( 'wp_resource_hints', array( $this, '_add_malformed_url_errant_colon' ), 10, 2 );
|
add_filter( 'wp_resource_hints', array( $this, '_add_malformed_url_errant_colon' ), 10, 2 );
|
||||||
|
|
Loading…
Reference in New Issue