mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Fix servo build and tidy lints.
This commit is contained in:
parent
a51b4e754c
commit
05f9f10a1c
9 changed files with 28 additions and 117 deletions
|
@ -35,19 +35,3 @@ fn test_steps() {
|
|||
assert!(parse(transition_timing_function::parse, "steps(-1)").is_err());
|
||||
assert!(parse(transition_timing_function::parse, "steps(1, middle)").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_frames() {
|
||||
assert_roundtrip_with_context!(transition_timing_function::parse, "frames( 2 )", "frames(2)");
|
||||
assert_roundtrip_with_context!(transition_timing_function::parse, "frames(10000)");
|
||||
|
||||
// Frames number must be an integer greater than 1
|
||||
assert!(parse(transition_timing_function::parse, "frames(1)").is_err());
|
||||
assert!(parse(transition_timing_function::parse, "frames(-2)").is_err());
|
||||
assert!(parse(transition_timing_function::parse, "frames()").is_err());
|
||||
assert!(parse(transition_timing_function::parse, "frames(,)").is_err());
|
||||
assert!(parse(transition_timing_function::parse, "frames(a)").is_err());
|
||||
assert!(parse(transition_timing_function::parse, "frames(2.0)").is_err());
|
||||
assert!(parse(transition_timing_function::parse, "frames(2.5)").is_err());
|
||||
assert!(parse(transition_timing_function::parse, "frames(2 3)").is_err());
|
||||
}
|
||||
|
|
|
@ -707,86 +707,6 @@ mod shorthand_serialization {
|
|||
}
|
||||
}
|
||||
|
||||
mod transition {
|
||||
pub use super::*;
|
||||
|
||||
#[test]
|
||||
fn transition_should_serialize_all_available_properties() {
|
||||
let block_text = "transition-property: margin-left; \
|
||||
transition-duration: 3s; \
|
||||
transition-delay: 4s; \
|
||||
transition-timing-function: cubic-bezier(0.2, 5, 0.5, 2);";
|
||||
|
||||
let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap();
|
||||
|
||||
let serialization = block.to_css_string();
|
||||
|
||||
assert_eq!(serialization, "transition: margin-left 3s cubic-bezier(0.2, 5, 0.5, 2) 4s;");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_multiple_transitions() {
|
||||
let block_text = "transition-property: margin-left, width; \
|
||||
transition-duration: 3s, 2s; \
|
||||
transition-delay: 4s, 5s; \
|
||||
transition-timing-function: cubic-bezier(0.2, 5, 0.5, 2), ease;";
|
||||
|
||||
let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap();
|
||||
|
||||
let serialization = block.to_css_string();
|
||||
|
||||
assert_eq!(serialization, "transition: \
|
||||
margin-left 3s cubic-bezier(0.2, 5, 0.5, 2) 4s, \
|
||||
width 2s ease 5s;");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_multiple_transitions_unequal_property_lists() {
|
||||
// When the lengths of property values are different, the shorthand serialization
|
||||
// should not be used. Previously the implementation cycled values if the lists were
|
||||
// uneven. This is incorrect, in that we should serialize to a shorthand only when the
|
||||
// lists have the same length (this affects background, transition and animation).
|
||||
// https://github.com/servo/servo/issues/15398 )
|
||||
// The duration below has 1 extra value.
|
||||
let block_text = "transition-property: margin-left, width; \
|
||||
transition-duration: 3s, 2s, 4s; \
|
||||
transition-delay: 4s, 5s; \
|
||||
transition-timing-function: cubic-bezier(0.2, 5, 0.5, 2), ease;";
|
||||
|
||||
let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap();
|
||||
|
||||
let serialization = block.to_css_string();
|
||||
|
||||
assert_eq!(serialization, block_text);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transition_should_serialize_acceptable_step_timing_function() {
|
||||
let block_text = "transition-property: margin-left; \
|
||||
transition-duration: 3s; \
|
||||
transition-delay: 4s; \
|
||||
transition-timing-function: steps(2, start);";
|
||||
let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap();
|
||||
|
||||
let serialization = block.to_css_string();
|
||||
|
||||
assert_eq!(serialization, "transition: margin-left 3s steps(2, start) 4s;");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transition_should_serialize_acceptable_frames_timing_function() {
|
||||
let block_text = "transition-property: margin-left; \
|
||||
transition-duration: 3s; \
|
||||
transition-delay: 4s; \
|
||||
transition-timing-function: frames(2);";
|
||||
let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap();
|
||||
|
||||
let serialization = block.to_css_string();
|
||||
|
||||
assert_eq!(serialization, "transition: margin-left 3s frames(2) 4s;");
|
||||
}
|
||||
}
|
||||
|
||||
mod keywords {
|
||||
pub use super::*;
|
||||
#[test]
|
||||
|
|
|
@ -28,7 +28,7 @@ use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframePer
|
|||
use style::values::{KeyframesName, CustomIdent};
|
||||
use style::values::computed::Percentage;
|
||||
use style::values::specified::{LengthOrPercentageOrAuto, PositionComponent};
|
||||
use style::values::specified::transform::TimingFunction;
|
||||
use style::values::specified::TimingFunction;
|
||||
|
||||
pub fn block_from<I>(iterable: I) -> PropertyDeclarationBlock
|
||||
where I: IntoIterator<Item=(PropertyDeclaration, Importance)> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue