File size: 1,706 Bytes
065fee7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""Test current selectors."""
from .. import util


class TestCurrent(util.TestCase):
    """Test current selectors."""

    MARKUP = """
    <body>
    <div id="div">
    <p id="0">Some text <span id="1" class="foo:bar:foobar"> in a paragraph</span>.
    <a id="2" class="bar" href="http://google.com">Link</a>
    <a id="3">Placeholder text.</a>
    </p>
    </div>
    </body>
    """

    def test_current(self):
        """Test current (should match nothing)."""

        self.assert_selector(
            self.MARKUP,
            "p:current",
            [],
            flags=util.HTML
        )

    def test_not_current(self):
        """Test not current."""

        self.assert_selector(
            self.MARKUP,
            "p:not(:current)",
            ["0"],
            flags=util.HTML
        )

    def test_current_func(self):
        """Test the functional form of current (should match nothing)."""

        self.assert_selector(
            self.MARKUP,
            ":current(p, div, a)",
            [],
            flags=util.HTML
        )

    def test_current_func_nested(self):
        """Test the nested functional form of current (should match nothing)."""

        self.assert_selector(
            self.MARKUP,
            ":current(p, :not(div), a)",
            [],
            flags=util.HTML
        )

        self.assert_selector(
            self.MARKUP,
            "body :not(:current(p, div, a))",
            ["div", "0", "1", "2", "3"],
            flags=util.HTML
        )

        self.assert_selector(
            self.MARKUP,
            "body :not(:current(p, :not(div), a))",
            ["div", "0", "1", "2", "3"],
            flags=util.HTML
        )