From 605f4f3d6b65147e4f5831c43c3ed63317823b51 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Sat, 22 Aug 2020 19:18:28 -0400 Subject: [PATCH] allow = and == in media queries --- src/parse/media.rs | 4 ++-- tests/media.rs | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/parse/media.rs b/src/parse/media.rs index ff93a99..45e3865 100644 --- a/src/parse/media.rs +++ b/src/parse/media.rs @@ -36,10 +36,10 @@ impl<'a> Parser<'a> { Some(Token { kind: '=', .. }) => { if matches!(toks.peek_next(), Some(Token { kind: '=', .. })) { toks.reset_cursor(); - true + false } else { toks.reset_cursor(); - false + true } } _ => false, diff --git a/tests/media.rs b/tests/media.rs index 0b5c061..a350ce8 100644 --- a/tests/media.rs +++ b/tests/media.rs @@ -88,6 +88,26 @@ test!( }", "@media (true) {\n a {\n interpolation: in-parens;\n }\n}\n" ); +test!( + single_eq_in_query, + "@media (height=600px) { + a { + b: c + } + } + ", + "@media (height = 600px) {\n a {\n b: c;\n }\n}\n" +); +test!( + double_eq_in_query, + "@media (height==600px) { + a { + b: c + } + } + ", + "@media (false) {\n a {\n b: c;\n }\n}\n" +); error!( media_feature_missing_closing_paren, "@media foo and (bar:a", "Error: expected \")\"."