inherited_text.rs (1636B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ 4 5 use parsing::parse; 6 use style::values::generics::text::Spacing; 7 8 #[test] 9 fn negative_letter_spacing_should_parse_properly() { 10 use style::properties::longhands::letter_spacing; 11 use style::values::specified::length::{FontRelativeLength, Length, NoCalcLength}; 12 13 let negative_value = parse_longhand!(letter_spacing, "-0.5em"); 14 let expected = Spacing::Value(Length::NoCalc(NoCalcLength::FontRelative( 15 FontRelativeLength::Em(-0.5), 16 ))); 17 assert_eq!(negative_value, expected); 18 } 19 20 #[test] 21 fn negative_word_spacing_should_parse_properly() { 22 use style::properties::longhands::word_spacing; 23 use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength}; 24 25 let negative_value = parse_longhand!(word_spacing, "-0.5em"); 26 let expected = Spacing::Value(LengthPercentage::Length(NoCalcLength::FontRelative( 27 FontRelativeLength::Em(-0.5), 28 ))); 29 assert_eq!(negative_value, expected); 30 } 31 32 #[test] 33 fn line_height_should_return_number_on_plain_zero() { 34 use style::properties::longhands::line_height; 35 36 let result = parse(line_height::parse, "0").unwrap(); 37 assert_eq!(result, parse_longhand!(line_height, "0")); 38 } 39 40 #[test] 41 fn line_height_should_return_length_on_length_zero() { 42 use style::properties::longhands::line_height; 43 44 let result = parse(line_height::parse, "0px").unwrap(); 45 assert_eq!(result, parse_longhand!(line_height, "0px")); 46 }