mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
fixes quote transform: none serialization
This commit is contained in:
parent
2af79b82f2
commit
bdd3ab1fe0
2 changed files with 28 additions and 0 deletions
|
@ -54,6 +54,10 @@ ${helpers.predefined_type("list-style-image", "UrlOrNone", "Either::Second(None_
|
||||||
|
|
||||||
impl ToCss for SpecifiedValue {
|
impl ToCss for SpecifiedValue {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
|
if self.0.is_empty() {
|
||||||
|
return dest.write_str("none")
|
||||||
|
}
|
||||||
|
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
for pair in &self.0 {
|
for pair in &self.0 {
|
||||||
if !first {
|
if !first {
|
||||||
|
|
|
@ -1114,4 +1114,28 @@ mod shorthand_serialization {
|
||||||
assert_eq!(s, "none");
|
assert_eq!(s, "none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod quotes {
|
||||||
|
pub use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_serialize_none_correctly() {
|
||||||
|
use cssparser::Parser;
|
||||||
|
use media_queries::CSSErrorReporterTest;
|
||||||
|
use style::parser::ParserContext;
|
||||||
|
use style::properties::longhands::quotes;
|
||||||
|
use style::stylesheets::Origin;
|
||||||
|
|
||||||
|
let mut s = String::new();
|
||||||
|
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
|
||||||
|
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
|
||||||
|
|
||||||
|
let parsed = quotes::parse(&context, &mut Parser::new("none")).unwrap();
|
||||||
|
let try_serialize = parsed.to_css(&mut s);
|
||||||
|
|
||||||
|
assert_eq!(try_serialize.is_ok(), true);
|
||||||
|
assert_eq!(s, "none");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue