Skip to content

Commit

Permalink
fix: Missing semicolon in Custom Media Queries (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marabyte authored Aug 25, 2022
1 parent dc9c59e commit 6efa74d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rules/custom_media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ impl<'i> ToCss for CustomMediaRule<'i> {
dest.write_str("@custom-media ")?;
self.name.to_css(dest)?;
dest.write_char(' ')?;
self.query.to_css(dest)
self.query.to_css(dest)?;
dest.write_char(';')
}
}
19 changes: 19 additions & 0 deletions tests/cli_integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,22 @@ fn targets() -> Result<(), Box<dyn std::error::Error>> {

Ok(())
}

#[test]
fn preserve_custom_media() -> Result<(), Box<dyn std::error::Error>> {
let file = assert_fs::NamedTempFile::new("test.css")?;
file.write_str(
r#"
@custom-media --foo print;
"#,
)?;

let mut cmd = Command::cargo_bin("parcel_css")?;
cmd.arg(file.path());
cmd.arg("--custom-media");
cmd.assert().success().stdout(predicate::str::contains(indoc! {r#"
@custom-media --foo print;
"#}));

Ok(())
}

0 comments on commit 6efa74d

Please sign in to comment.