text_overflow.rs (1334B)
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_traits::ToCss; 7 8 #[test] 9 fn test_text_overflow() { 10 use style::properties::longhands::text_overflow; 11 12 assert_roundtrip_with_context!(text_overflow::parse, r#"clip"#); 13 assert_roundtrip_with_context!(text_overflow::parse, r#"ellipsis"#); 14 assert_roundtrip_with_context!(text_overflow::parse, r#"clip ellipsis"#); 15 assert_roundtrip_with_context!(text_overflow::parse, r#""x""#); 16 assert_roundtrip_with_context!(text_overflow::parse, r#"'x'"#, r#""x""#); 17 assert_roundtrip_with_context!(text_overflow::parse, r#"clip "x""#); 18 assert_roundtrip_with_context!(text_overflow::parse, r#""x" clip"#); 19 assert_roundtrip_with_context!(text_overflow::parse, r#""x" "y""#); 20 } 21 22 #[test] 23 fn test_text_overflow_parser_exhaustion() { 24 use style::properties::longhands::text_overflow; 25 26 assert_parser_exhausted!(text_overflow::parse, r#"clip rubbish"#, false); 27 assert_parser_exhausted!(text_overflow::parse, r#"clip"#, true); 28 assert_parser_exhausted!(text_overflow::parse, r#"ellipsis"#, true); 29 assert_parser_exhausted!(text_overflow::parse, r#"clip ellipsis"#, true); 30 }