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]
negative_letter_spacing_should_parse_properly()9 fn negative_letter_spacing_should_parse_properly() {
10 use style::properties::longhands::letter_spacing;
11 use style::values::specified::length::{Length, NoCalcLength, FontRelativeLength};
12
13 let negative_value = parse_longhand!(letter_spacing, "-0.5em");
14 let expected = Spacing::Value(Length::NoCalc(NoCalcLength::FontRelative(FontRelativeLength::Em(-0.5))));
15 assert_eq!(negative_value, expected);
16 }
17
18 #[test]
negative_word_spacing_should_parse_properly()19 fn negative_word_spacing_should_parse_properly() {
20 use style::properties::longhands::word_spacing;
21 use style::values::specified::length::{NoCalcLength, LengthPercentage, FontRelativeLength};
22
23 let negative_value = parse_longhand!(word_spacing, "-0.5em");
24 let expected = Spacing::Value(LengthPercentage::Length(
25 NoCalcLength::FontRelative(FontRelativeLength::Em(-0.5))
26 ));
27 assert_eq!(negative_value, expected);
28 }
29
30 #[test]
line_height_should_return_number_on_plain_zero()31 fn line_height_should_return_number_on_plain_zero() {
32 use style::properties::longhands::line_height;
33
34 let result = parse(line_height::parse, "0").unwrap();
35 assert_eq!(result, parse_longhand!(line_height, "0"));
36 }
37
38 #[test]
line_height_should_return_length_on_length_zero()39 fn line_height_should_return_length_on_length_zero() {
40 use style::properties::longhands::line_height;
41
42 let result = parse(line_height::parse, "0px").unwrap();
43 assert_eq!(result, parse_longhand!(line_height, "0px"));
44 }
45