mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #15861 - projektir:make-text-decoration-testable, r=Wafflespeanut
Make text decoration testable and do not serialize initial text-decoration-style Servo now uses the same name for the text-decoration-line longhand property as Gecko. This was done to enable testing of the text-decoration shorthand. The text-decoration shorthand has been fixed to not serialize initial text-decoration-style. --- - [x ] `./mach build -d` does not report any errors - [x ] `./mach test-tidy` does not report any errors - [x ] These changes fix #15790 --- - [x ] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15861) <!-- Reviewable:end -->
This commit is contained in:
commit
dc3b32c853
7 changed files with 97 additions and 32 deletions
|
@ -112,6 +112,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