| 1 | // Copyright 2019 the SimpleCSS Authors |
| 2 | // SPDX-License-Identifier: Apache-2.0 OR MIT |
| 3 | |
| 4 | //! Specificity |
| 5 | |
| 6 | use simplecssrust-analyzer cargo simplecss 0.2.2 crate/::*; |
| 7 | |
| 8 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 9 | fn spec_01rust-analyzer cargo simplecss 0.2.2 spec_01().() { |
| 10 | let selectors = Selectorrust-analyzer cargo simplecss 0.2.2 selector/Selector#::parserust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]parse().("*").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 11 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(selectors.specificityrust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]specificity().(), [0, 0, 0]); |
| 12 | } |
| 13 | |
| 14 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 15 | fn spec_02rust-analyzer cargo simplecss 0.2.2 spec_02().() { |
| 16 | let selectors = Selectorrust-analyzer cargo simplecss 0.2.2 selector/Selector#::parserust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]parse().("li").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 17 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(selectors.specificityrust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]specificity().(), [0, 0, 1]); |
| 18 | } |
| 19 | |
| 20 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 21 | fn spec_03rust-analyzer cargo simplecss 0.2.2 spec_03().() { |
| 22 | let selectors = Selectorrust-analyzer cargo simplecss 0.2.2 selector/Selector#::parserust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]parse().("ul li").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 23 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(selectors.specificityrust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]specificity().(), [0, 0, 2]); |
| 24 | } |
| 25 | |
| 26 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 27 | fn spec_04rust-analyzer cargo simplecss 0.2.2 spec_04().() { |
| 28 | let selectors = Selectorrust-analyzer cargo simplecss 0.2.2 selector/Selector#::parserust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]parse().("ul ol + li").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 29 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(selectors.specificityrust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]specificity().(), [0, 0, 3]); |
| 30 | } |
| 31 | |
| 32 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 33 | fn spec_05rust-analyzer cargo simplecss 0.2.2 spec_05().() { |
| 34 | let selectors = Selectorrust-analyzer cargo simplecss 0.2.2 selector/Selector#::parserust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]parse().("h1 + *[rel=up]").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 35 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(selectors.specificityrust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]specificity().(), [0, 1, 1]); |
| 36 | } |
| 37 | |
| 38 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 39 | fn spec_06rust-analyzer cargo simplecss 0.2.2 spec_06().() { |
| 40 | let selectors = Selectorrust-analyzer cargo simplecss 0.2.2 selector/Selector#::parserust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]parse().("ul ol li.red").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 41 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(selectors.specificityrust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]specificity().(), [0, 1, 3]); |
| 42 | } |
| 43 | |
| 44 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 45 | fn spec_07rust-analyzer cargo simplecss 0.2.2 spec_07().() { |
| 46 | let selectors = Selectorrust-analyzer cargo simplecss 0.2.2 selector/Selector#::parserust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]parse().("li.red.level").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 47 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(selectors.specificityrust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]specificity().(), [0, 2, 1]); |
| 48 | } |
| 49 | |
| 50 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 51 | fn spec_08rust-analyzer cargo simplecss 0.2.2 spec_08().() { |
| 52 | let selectors = Selectorrust-analyzer cargo simplecss 0.2.2 selector/Selector#::parserust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]parse().("#x34y").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 53 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(selectors.specificityrust-analyzer cargo simplecss 0.2.2 selector/impl#[`Selector<'a>`]specificity().(), [1, 0, 0]); |
| 54 | } |