implement parsing of line_height and border_image_outset to parse plain zero as Number

This commit is contained in:
Atheed Thameem 2017-01-27 21:09:44 -05:00
parent b38da9b920
commit beeca1213c
4 changed files with 69 additions and 18 deletions

View file

@ -104,3 +104,21 @@ fn border_image_outset_should_error_on_negative_number() {
let result = border_image_outset::parse(&context, &mut parser);
assert_eq!(result, Err(()));
}
#[test]
fn border_image_outset_should_return_number_on_plain_zero() {
let url = ServoUrl::parse("http://localhost").unwrap();
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
let mut parser = Parser::new("0");
let result = border_image_outset::parse(&context, &mut parser);
assert_eq!(result.unwrap(), parse_longhand!(border_image_outset, "0"));
}
#[test]
fn border_image_outset_should_return_length_on_length_zero() {
let url = ServoUrl::parse("http://localhost").unwrap();
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
let mut parser = Parser::new("0em");
let result = border_image_outset::parse(&context, &mut parser);
assert_eq!(result.unwrap(), parse_longhand!(border_image_outset, "0em"));
}