mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Don't serialize initial text-decoration-style #15790
This commit is contained in:
parent
b11847d86c
commit
b4c50de31e
7 changed files with 97 additions and 32 deletions
|
@ -117,6 +117,47 @@ mod shorthand_serialization {
|
|||
}
|
||||
}
|
||||
|
||||
mod text {
|
||||
use style::properties::longhands::text_decoration_line as TextDecorationLine;
|
||||
use style::properties::longhands::text_decoration_style::SpecifiedValue as TextDecorationStyle;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn text_decoration_should_show_all_properties_when_set() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let line = DeclaredValue::Value(TextDecorationLine::OVERLINE);
|
||||
let style = DeclaredValue::Value(TextDecorationStyle::dotted);
|
||||
let color = DeclaredValue::Value(CSSColor {
|
||||
parsed: ComputedColor::RGBA(RGBA::new(128, 0, 128, 255)),
|
||||
authored: None
|
||||
});
|
||||
|
||||
properties.push(PropertyDeclaration::TextDecorationLine(line));
|
||||
properties.push(PropertyDeclaration::TextDecorationStyle(style));
|
||||
properties.push(PropertyDeclaration::TextDecorationColor(color));
|
||||
|
||||
let serialization = shorthand_properties_to_string(properties);
|
||||
assert_eq!(serialization, "text-decoration: overline dotted rgb(128, 0, 128);");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_decoration_should_not_serialize_initial_style_value() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let line = DeclaredValue::Value(TextDecorationLine::UNDERLINE);
|
||||
let style = DeclaredValue::Value(TextDecorationStyle::solid);
|
||||
let color = DeclaredValue::Value(CSSColor::currentcolor());
|
||||
|
||||
properties.push(PropertyDeclaration::TextDecorationLine(line));
|
||||
properties.push(PropertyDeclaration::TextDecorationStyle(style));
|
||||
properties.push(PropertyDeclaration::TextDecorationColor(color));
|
||||
|
||||
let serialization = shorthand_properties_to_string(properties);
|
||||
assert_eq!(serialization, "text-decoration: underline;");
|
||||
}
|
||||
}
|
||||
|
||||
mod four_sides_shorthands {
|
||||
pub use super::*;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue