mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Ensure that inline styles attached to conditional stylesheets are also conditional.
Adds unit test. Props georgestephanis. Fixes #29180. git-svn-id: https://develop.svn.wordpress.org/trunk@31031 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -96,7 +96,7 @@ class Tests_Dependencies_Styles extends WP_UnitTestCase {
|
||||
$style = ".thing {\n";
|
||||
$style .= "\tbackground: red;\n";
|
||||
$style .= "}";
|
||||
|
||||
|
||||
$expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css' media='all' />\n";
|
||||
$expected .= "<style id='handle-inline-css' type='text/css'>\n";
|
||||
$expected .= "$style\n";
|
||||
@@ -147,7 +147,7 @@ class Tests_Dependencies_Styles extends WP_UnitTestCase {
|
||||
$style1 = ".thing1 {\n";
|
||||
$style1 .= "\tbackground: red;\n";
|
||||
$style1 .= "}";
|
||||
|
||||
|
||||
$style2 = ".thing2 {\n";
|
||||
$style2 .= "\tbackground: blue;\n";
|
||||
$style2 .= "}";
|
||||
@@ -206,4 +206,25 @@ class Tests_Dependencies_Styles extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to make sure that inline styles attached to conditional
|
||||
* stylesheets are also conditional.
|
||||
*/
|
||||
public function test_conditional_inline_styles_are_also_conditional() {
|
||||
$expected = <<<CSS
|
||||
<!--[if IE]>
|
||||
<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css' media='all' />
|
||||
<style id='handle-inline-css' type='text/css'>
|
||||
a { color: blue; }
|
||||
</style>
|
||||
<![endif]-->
|
||||
|
||||
CSS;
|
||||
wp_enqueue_style( 'handle', 'http://example.com', array(), 1 );
|
||||
wp_style_add_data( 'handle', 'conditional', 'IE' );
|
||||
wp_add_inline_style( 'handle', 'a { color: blue; }' );
|
||||
|
||||
$this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user