Styles: Clarify the allowed values for the $media parameter of wp_register_style()/wp_enqueue_style().

Adds unit test.

Fixes #35921.

git-svn-id: https://develop.svn.wordpress.org/trunk@36649 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90)
2016-02-23 20:40:43 +00:00
parent 3039740a3a
commit 3a836ea224
2 changed files with 42 additions and 4 deletions

View File

@@ -261,4 +261,41 @@ CSS;
$this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
}
/**
* @ticket 35921
* @dataProvider data_styles_with_media
*/
function test_wp_enqueue_style_with_media( $expected, $media ) {
wp_enqueue_style( 'handle', 'http://example.com', array(), 1, $media );
$this->assertContains( $expected, get_echo( 'wp_print_styles' ) );
}
function data_styles_with_media() {
return array(
array(
"media='all'",
'all'
),
array(
"media='(orientation: portrait)'",
'(orientation: portrait)'
),
array(
"media='(max-width: 640px)'",
'(max-width: 640px)'
),
array(
"media='print and (min-width: 25cm)'",
'print and (min-width: 25cm)'
),
array(
"media='screen and (color), projection and (color)'",
'screen and (color), projection and (color)'
),
array(
"media='not screen and (color)'",
'not screen and (color)'
),
);
}
}