fix to ensure all font-weight keywords are preserved

This commit is contained in:
Atheed Thameem 2017-02-02 20:31:39 -05:00
parent c48a326fb3
commit 17c74cf967
3 changed files with 26 additions and 6 deletions

View file

@ -6,7 +6,7 @@ use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use servo_url::ServoUrl;
use style::parser::ParserContext;
use style::properties::longhands::font_feature_settings;
use style::properties::longhands::{font_feature_settings, font_weight};
use style::properties::longhands::font_feature_settings::computed_value;
use style::properties::longhands::font_feature_settings::computed_value::FeatureTagValue;
use style::stylesheets::Origin;
@ -98,6 +98,21 @@ fn font_language_override_should_parse_properly() {
assert_eq!(danish, SpecifiedValue::Override("DAN".to_string()));
}
#[test]
fn font_weight_keyword_should_preserve_keyword() {
use style::properties::longhands::font_weight::SpecifiedValue;
let url = ServoUrl::parse("http://localhost").unwrap();
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
let mut parser = Parser::new("normal");
let result = font_weight::parse(&context, &mut parser);
assert_eq!(result.unwrap(), SpecifiedValue::Normal);
let mut parser = Parser::new("bold");
let result = font_weight::parse(&context, &mut parser);
assert_eq!(result.unwrap(), SpecifiedValue::Bold);
}
#[test]
#[should_panic]
fn font_language_override_should_fail_on_empty_str() {

View file

@ -33,6 +33,3 @@
[list is expected to be list-style: circle inside;]
expected: FAIL
[font-family is expected to be font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: italic; font-weight: bold;]
expected: FAIL