public void PseudoNot() { var selector = new SelectorSyntaxParser().Parse(":not([Name='Foo'])"); var expected = new ComplexSelectorList(new ComplexSelector( new NotPseudoClassSelector(new PropertyExactMatchSelector("Name", "Foo")) )); selector.ToSelectorString().Should().Be(expected.ToSelectorString()); }
public void PseudoIs() { var selector = new SelectorSyntaxParser().Parse(":is(PredefinedType, GenericName, :not([Name='Foo']))"); var expected = new ComplexSelectorList(new ComplexSelector( new IsPseudoClassSelector( new TypeSelector(SyntaxKind.PredefinedType), new TypeSelector(SyntaxKind.GenericName), new NotPseudoClassSelector(new PropertyExactMatchSelector("Name", "Foo")) ) )); selector.ToSelectorString().Should().Be(expected.ToSelectorString()); }
public void Complex_1() { var selector = new SelectorSyntaxParser().Parse(":class :method:not([Name='Foo']) SwitchSection ObjectCreationExpression > :is(PredefinedType, GenericName)[Name^='List'] "); var expected = new ComplexSelectorList(new ComplexSelector( new CompoundSelector(new ClassPseudoClassSelector()), new DescendantCombinator(), new CompoundSelector(new MethodPseudoClassSelector(), new NotPseudoClassSelector(new PropertyExactMatchSelector("Name", "Foo"))), new DescendantCombinator(), new CompoundSelector(new TypeSelector(SyntaxKind.SwitchSection)), new DescendantCombinator(), new CompoundSelector(new TypeSelector(SyntaxKind.ObjectCreationExpression)), new ChildCombinator(), new CompoundSelector( new IsPseudoClassSelector( new TypeSelector(SyntaxKind.PredefinedType), new TypeSelector(SyntaxKind.GenericName) ), new PropertyPrefixMatchSelector("Name", "List") ) )); selector.ToSelectorString().Should().Be(expected.ToSelectorString()); }