Test valid media queries.
public function testValidMediaQueries() {
$media_queries = array(
// Bartik breakpoints.
'(min-width: 0px)',
'all and (min-width: 560px) and (max-width:850px)',
'all and (min-width: 851px)',
// Seven breakpoints.
'(min-width: 0em)',
'screen and (min-width: 40em)',
// Stark breakpoints.
'(min-width: 0px)',
'all and (min-width: 480px) and (max-width: 959px)',
'all and (min-width: 960px)',
// Other media queries.
'(orientation)',
'all and (orientation)',
'not all and (orientation)',
'only all and (orientation)',
'screen and (width)',
'screen and (width: 0)',
'screen and (width: 0px)',
'screen and (width: 0em)',
'screen and (min-width: -0)',
'screen and (max-width: 0)',
'screen and (max-width: 0.3)',
'screen and (min-width)',
// Multiline and comments.
'screen and /* this is a comment */ (min-width)',
"screen\nand /* this is a comment */ (min-width)",
"screen\n\nand /* this is\n a comment */ (min-width)",
// Unrecognized features are allowed.
'screen and (-webkit-min-device-pixel-ratio: 7)',
'screen and (min-orientation: landscape)',
'screen and (max-orientation: landscape)',
);
foreach ($media_queries as $media_query) {
$this
->assertTrue(Breakpoint::isValidMediaQuery($media_query), $media_query . ' is valid.');
}
}