stylo: support all overflow values

MozReview-Commit-ID: 1iQdUDsb6u9
This commit is contained in:
Manish Goregaokar 2017-04-24 19:47:37 -07:00 committed by Manish Goregaokar
parent e3e10ada09
commit f8e298b2b3
10 changed files with 63 additions and 81 deletions

View file

@ -16,8 +16,7 @@ use stylesheets::block_from;
#[test]
fn property_declaration_block_should_serialize_correctly() {
use style::properties::longhands::overflow_x::SpecifiedValue as OverflowXValue;
use style::properties::longhands::overflow_y::SpecifiedValue as OverflowYContainer;
use style::properties::longhands::overflow_x::SpecifiedValue as OverflowValue;
let declarations = vec![
(PropertyDeclaration::Width(
@ -37,11 +36,11 @@ fn property_declaration_block_should_serialize_correctly() {
Importance::Normal),
(PropertyDeclaration::OverflowX(
OverflowXValue::auto),
OverflowValue::auto),
Importance::Normal),
(PropertyDeclaration::OverflowY(
OverflowYContainer(OverflowXValue::auto)),
OverflowValue::auto),
Importance::Normal),
];
@ -68,18 +67,15 @@ mod shorthand_serialization {
mod overflow {
pub use super::*;
use style::properties::longhands::overflow_x::SpecifiedValue as OverflowXValue;
use style::properties::longhands::overflow_y::SpecifiedValue as OverflowYContainer;
use style::properties::longhands::overflow_x::SpecifiedValue as OverflowValue;
#[test]
fn equal_overflow_properties_should_serialize_to_single_value() {
let mut properties = Vec::new();
let overflow_x = OverflowXValue::auto;
properties.push(PropertyDeclaration::OverflowX(overflow_x));
let overflow_y = OverflowYContainer(OverflowXValue::auto);
properties.push(PropertyDeclaration::OverflowY(overflow_y));
let overflow = OverflowValue::auto;
properties.push(PropertyDeclaration::OverflowX(overflow));
properties.push(PropertyDeclaration::OverflowY(overflow));
let serialization = shorthand_properties_to_string(properties);
assert_eq!(serialization, "overflow: auto;");
@ -89,10 +85,10 @@ mod shorthand_serialization {
fn different_overflow_properties_should_serialize_to_two_values() {
let mut properties = Vec::new();
let overflow_x = OverflowXValue::scroll;
let overflow_x = OverflowValue::scroll;
properties.push(PropertyDeclaration::OverflowX(overflow_x));
let overflow_y = OverflowYContainer(OverflowXValue::auto);
let overflow_y = OverflowValue::auto;
properties.push(PropertyDeclaration::OverflowY(overflow_y));
let serialization = shorthand_properties_to_string(properties);