mirror of
https://github.com/servo/servo.git
synced 2025-08-09 07:25:35 +01:00
Update selectors to 0.10, with ToCss serialization.
This commit is contained in:
parent
4e7c689a81
commit
d690bd2382
20 changed files with 186 additions and 62 deletions
22
tests/unit/style/parsing/selectors.rs
Normal file
22
tests/unit/style/parsing/selectors.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::Parser;
|
||||
use selectors::parser::{Selector, ParserContext, parse_selector_list};
|
||||
use style::selector_impl::TheSelectorImpl;
|
||||
|
||||
fn parse(input: &mut Parser) -> Result<Selector<TheSelectorImpl>, ()> {
|
||||
let mut context = ParserContext::new();
|
||||
context.in_user_agent_stylesheet = true;
|
||||
context.namespace_prefixes.insert("svg".into(), ns!(svg));
|
||||
parse_selector_list(&context, input).map(|mut vec| vec.pop().unwrap())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_selectors() {
|
||||
assert_roundtrip!(parse, "div");
|
||||
assert_roundtrip!(parse, "svg|circle");
|
||||
assert_roundtrip!(parse, "p:before", "p::before");
|
||||
assert_roundtrip!(parse, "[border = \"0\"]:-servo-nonzero-border ~ ::-servo-details-summary");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue