@@ -3,7 +3,7 @@ include: "utils.goml"
3
3
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
4
4
show-text: true
5
5
// Check that we can click on the line number.
6
- click: ".src-line-numbers > a:nth-child(4) " // This is the anchor for line 4.
6
+ click: "//a[@data-nosnippet and text()='4'] " // This is the anchor for line 4.
7
7
// Ensure that the page URL was updated.
8
8
assert-document-property: ({"URL": "lib.rs.html#4"}, ENDS_WITH)
9
9
assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"})
@@ -14,24 +14,24 @@ assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"})
14
14
assert-css: ("//*[@id='4']", {"border-right-width": "0px"})
15
15
// We now check that the good anchors are highlighted
16
16
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#4-6"
17
- assert-attribute-false: (".src-line-numbers > a:nth-child(3) ", {"class": "line-highlighted"})
18
- assert-attribute: (".src-line-numbers > a:nth-child(4) ", {"class": "line-highlighted"})
19
- assert-attribute: (".src-line-numbers > a:nth-child(5) ", {"class": "line-highlighted"})
20
- assert-attribute: (".src-line-numbers > a:nth-child(6) ", {"class": "line-highlighted"})
21
- assert-attribute-false: (".src-line-numbers > a:nth-child(7) ", {"class": "line-highlighted"})
17
+ assert-attribute-false: ("//a[@data-nosnippet and text()='3'] ", {"class": "line-highlighted"})
18
+ assert-attribute: ("//a[@data-nosnippet and text()='4'] ", {"class": "line-highlighted"})
19
+ assert-attribute: ("//a[@data-nosnippet and text()='5'] ", {"class": "line-highlighted"})
20
+ assert-attribute: ("//a[@data-nosnippet and text()='6'] ", {"class": "line-highlighted"})
21
+ assert-attribute-false: ("//a[@data-nosnippet and text()='7'] ", {"class": "line-highlighted"})
22
22
23
23
define-function: (
24
24
"check-colors",
25
25
[theme, color, background_color, highlight_color, highlight_background_color],
26
26
block {
27
27
call-function: ("switch-theme", {"theme": |theme|})
28
28
assert-css: (
29
- ".src-line-numbers > a :not(.line-highlighted)",
29
+ "a[data-nosnippet] :not(.line-highlighted)",
30
30
{"color": |color|, "background-color": |background_color|},
31
31
ALL,
32
32
)
33
33
assert-css: (
34
- ".src-line-numbers > a .line-highlighted",
34
+ "a[data-nosnippet] .line-highlighted",
35
35
{"color": |highlight_color|, "background-color": |highlight_background_color|},
36
36
ALL,
37
37
)
@@ -61,37 +61,37 @@ call-function: ("check-colors", {
61
61
})
62
62
63
63
// This is to ensure that the content is correctly align with the line numbers.
64
- compare-elements-position: ("//*[@id='1']", ".rust > code > span", [ "y"] )
64
+ compare-elements-position-near : ("//*[@id='1']", ".rust > code > span", { "y": 2} )
65
65
// Check the `href` property so that users can treat anchors as links.
66
- assert-property: (".src-line-numbers > a:nth-child(1) ", {
66
+ assert-property: ("//a[@data-nosnippet and text()='1'] ", {
67
67
"href": |DOC_PATH| + "/src/test_docs/lib.rs.html#1"
68
68
}, ENDS_WITH)
69
- assert-property: (".src-line-numbers > a:nth-child(2) ", {
69
+ assert-property: ("//a[@data-nosnippet and text()='2'] ", {
70
70
"href": |DOC_PATH| + "/src/test_docs/lib.rs.html#2"
71
71
}, ENDS_WITH)
72
- assert-property: (".src-line-numbers > a:nth-child(3) ", {
72
+ assert-property: ("//a[@data-nosnippet and text()='3'] ", {
73
73
"href": |DOC_PATH| + "/src/test_docs/lib.rs.html#3"
74
74
}, ENDS_WITH)
75
- assert-property: (".src-line-numbers > a:nth-child(4) ", {
75
+ assert-property: ("//a[@data-nosnippet and text()='4'] ", {
76
76
"href": |DOC_PATH| + "/src/test_docs/lib.rs.html#4"
77
77
}, ENDS_WITH)
78
- assert-property: (".src-line-numbers > a:nth-child(5) ", {
78
+ assert-property: ("//a[@data-nosnippet and text()='5'] ", {
79
79
"href": |DOC_PATH| + "/src/test_docs/lib.rs.html#5"
80
80
}, ENDS_WITH)
81
- assert-property: (".src-line-numbers > a:nth-child(6) ", {
81
+ assert-property: ("//a[@data-nosnippet and text()='6'] ", {
82
82
"href": |DOC_PATH| + "/src/test_docs/lib.rs.html#6"
83
83
}, ENDS_WITH)
84
84
85
85
// Assert that the line numbers text is aligned to the right.
86
- assert-css: (".src-line-numbers ", {"text-align": "right"})
86
+ assert-css: ("a[data-nosnippet] ", {"text-align": "right"}, ALL )
87
87
88
88
// Now let's check that clicking on something else than the line number doesn't
89
89
// do anything (and certainly not add a `#NaN` to the URL!).
90
90
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
91
91
// We use this assert-position to know where we will click.
92
- assert-position: ("//*[@id='1']", {"x": 88 , "y": 171 })
93
- // We click on the left of the "1" anchor but still in the "src-line-number" `<pre> `.
94
- click: (163, 77 )
92
+ assert-position: ("//*[@id='1']", {"x": 81 , "y": 169 })
93
+ // We click on the left of the "1" anchor but still in the `a[data-nosnippet] `.
94
+ click: (77, 163 )
95
95
assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
96
96
97
97
// Checking the source code sidebar.
0 commit comments