Fix up unit tests

This commit is contained in:
Simon Sapin 2017-04-14 12:35:50 +02:00
parent 627c823d0a
commit 71f9a0c848
3 changed files with 11 additions and 8 deletions

View file

@ -7,6 +7,7 @@ use servo_atoms::Atom;
use style::parser::Parse;
use style::properties::longhands::animation_iteration_count::single_value::computed_value::T as AnimationIterationCount;
use style::properties::longhands::animation_name;
use style::values::CustomIdent;
use style_traits::ToCss;
#[test]
@ -14,13 +15,13 @@ fn test_animation_name() {
use self::animation_name::single_value::SpecifiedValue as SingleValue;
let other_name = Atom::from("other-name");
assert_eq!(parse_longhand!(animation_name, "none"),
animation_name::SpecifiedValue(vec![SingleValue(atom!(""))]));
animation_name::SpecifiedValue(vec![SingleValue(CustomIdent(atom!("")))]));
assert_eq!(parse_longhand!(animation_name, "other-name, none, 'other-name', \"other-name\""),
animation_name::SpecifiedValue(
vec![SingleValue(other_name.clone()),
SingleValue(atom!("")),
SingleValue(other_name.clone()),
SingleValue(other_name.clone())]));
vec![SingleValue(CustomIdent(other_name.clone())),
SingleValue(CustomIdent(atom!(""))),
SingleValue(CustomIdent(other_name.clone())),
SingleValue(CustomIdent(other_name.clone()))]));
}
#[test]

View file

@ -8,6 +8,7 @@ use style::properties::{PropertyDeclaration, Importance, PropertyId};
use style::properties::longhands::outline_color::computed_value::T as ComputedColor;
use style::properties::parse_property_declaration_list;
use style::values::{RGBA, Auto};
use style::values::CustomIdent;
use style::values::specified::{BorderStyle, BorderWidth, CSSColor, Length, NoCalcLength};
use style::values::specified::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrAutoOrContent};
use style::values::specified::url::SpecifiedUrl;
@ -1259,8 +1260,8 @@ mod shorthand_serialization {
fn counter_increment_with_properties_should_serialize_correctly() {
let mut properties = Vec::new();
properties.push(("counter1".to_owned(), Integer::new(1)));
properties.push(("counter2".to_owned(), Integer::new(-4)));
properties.push((CustomIdent("counter1".into()), Integer::new(1)));
properties.push((CustomIdent("counter2".into()), Integer::new(-4)));
let counter_increment = CounterIncrement(properties);
let counter_increment_css = "counter1 1 counter2 -4";

View file

@ -23,6 +23,7 @@ use style::properties::longhands::animation_play_state;
use style::shared_lock::SharedRwLock;
use style::stylesheets::{Origin, Namespaces};
use style::stylesheets::{Stylesheet, NamespaceRule, CssRule, CssRules, StyleRule, KeyframesRule};
use style::values::CustomIdent;
use style::values::specified::{LengthOrPercentageOrAuto, Percentage};
pub fn block_from<I>(iterable: I) -> PropertyDeclarationBlock
@ -221,7 +222,7 @@ fn test_parse_stylesheet() {
]))),
}))),
CssRule::Keyframes(Arc::new(stylesheet.shared_lock.wrap(KeyframesRule {
name: "foo".into(),
name: CustomIdent("foo".into()),
keyframes: vec![
Arc::new(stylesheet.shared_lock.wrap(Keyframe {
selector: KeyframeSelector::new_for_unit_testing(