@@ -3,7 +3,7 @@ include: "utils.goml"
33go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
44show-text: true
55// 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.
77// Ensure that the page URL was updated.
88assert-document-property: ({"URL": "lib.rs.html#4"}, ENDS_WITH)
99assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"})
@@ -14,24 +14,24 @@ assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"})
1414assert-css: ("//*[@id='4']", {"border-right-width": "0px"})
1515// We now check that the good anchors are highlighted
1616go-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"})
2222
2323define-function: (
2424 "check-colors",
2525 [theme, color, background_color, highlight_color, highlight_background_color],
2626 block {
2727 call-function: ("switch-theme", {"theme": |theme|})
2828 assert-css: (
29- ".src-line-numbers > a :not(.line-highlighted)",
29+ "a[data-nosnippet] :not(.line-highlighted)",
3030 {"color": |color|, "background-color": |background_color|},
3131 ALL,
3232 )
3333 assert-css: (
34- ".src-line-numbers > a .line-highlighted",
34+ "a[data-nosnippet] .line-highlighted",
3535 {"color": |highlight_color|, "background-color": |highlight_background_color|},
3636 ALL,
3737 )
@@ -61,37 +61,37 @@ call-function: ("check-colors", {
6161})
6262
6363// 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} )
6565// 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'] ", {
6767 "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#1"
6868}, ENDS_WITH)
69- assert-property: (".src-line-numbers > a:nth-child(2) ", {
69+ assert-property: ("//a[@data-nosnippet and text()='2'] ", {
7070 "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#2"
7171}, ENDS_WITH)
72- assert-property: (".src-line-numbers > a:nth-child(3) ", {
72+ assert-property: ("//a[@data-nosnippet and text()='3'] ", {
7373 "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#3"
7474}, ENDS_WITH)
75- assert-property: (".src-line-numbers > a:nth-child(4) ", {
75+ assert-property: ("//a[@data-nosnippet and text()='4'] ", {
7676 "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#4"
7777}, ENDS_WITH)
78- assert-property: (".src-line-numbers > a:nth-child(5) ", {
78+ assert-property: ("//a[@data-nosnippet and text()='5'] ", {
7979 "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#5"
8080}, ENDS_WITH)
81- assert-property: (".src-line-numbers > a:nth-child(6) ", {
81+ assert-property: ("//a[@data-nosnippet and text()='6'] ", {
8282 "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#6"
8383}, ENDS_WITH)
8484
8585// 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 )
8787
8888// Now let's check that clicking on something else than the line number doesn't
8989// do anything (and certainly not add a `#NaN` to the URL!).
9090go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
9191// 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 )
9595assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
9696
9797// Checking the source code sidebar.
0 commit comments