diff options
Diffstat (limited to 'tests/rustdoc-gui/source-code-page.goml')
| -rw-r--r-- | tests/rustdoc-gui/source-code-page.goml | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml index afb19462521..aa5a16aac70 100644 --- a/tests/rustdoc-gui/source-code-page.goml +++ b/tests/rustdoc-gui/source-code-page.goml @@ -3,7 +3,7 @@ include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" show-text: true // Check that we can click on the line number. -click: ".src-line-numbers > a:nth-child(4)" // This is the anchor for line 4. +click: "//a[@data-nosnippet and text()='4']" // This is the anchor for line 4. // Ensure that the page URL was updated. assert-document-property: ({"URL": "lib.rs.html#4"}, ENDS_WITH) assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"}) @@ -14,11 +14,11 @@ assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"}) assert-css: ("//*[@id='4']", {"border-right-width": "0px"}) // We now check that the good anchors are highlighted go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#4-6" -assert-attribute-false: (".src-line-numbers > a:nth-child(3)", {"class": "line-highlighted"}) -assert-attribute: (".src-line-numbers > a:nth-child(4)", {"class": "line-highlighted"}) -assert-attribute: (".src-line-numbers > a:nth-child(5)", {"class": "line-highlighted"}) -assert-attribute: (".src-line-numbers > a:nth-child(6)", {"class": "line-highlighted"}) -assert-attribute-false: (".src-line-numbers > a:nth-child(7)", {"class": "line-highlighted"}) +assert-attribute-false: ("//a[@data-nosnippet and text()='3']", {"class": "line-highlighted"}) +assert-attribute: ("//a[@data-nosnippet and text()='4']", {"class": "line-highlighted"}) +assert-attribute: ("//a[@data-nosnippet and text()='5']", {"class": "line-highlighted"}) +assert-attribute: ("//a[@data-nosnippet and text()='6']", {"class": "line-highlighted"}) +assert-attribute-false: ("//a[@data-nosnippet and text()='7']", {"class": "line-highlighted"}) define-function: ( "check-colors", @@ -26,12 +26,12 @@ define-function: ( block { call-function: ("switch-theme", {"theme": |theme|}) assert-css: ( - ".src-line-numbers > a:not(.line-highlighted)", + "a[data-nosnippet]:not(.line-highlighted)", {"color": |color|, "background-color": |background_color|}, ALL, ) assert-css: ( - ".src-line-numbers > a.line-highlighted", + "a[data-nosnippet].line-highlighted", {"color": |highlight_color|, "background-color": |highlight_background_color|}, ALL, ) @@ -61,37 +61,37 @@ call-function: ("check-colors", { }) // This is to ensure that the content is correctly align with the line numbers. -compare-elements-position: ("//*[@id='1']", ".rust > code > span", ["y"]) +compare-elements-position-near: ("//*[@id='1']", ".rust > code > span", {"y": 2}) // Check the `href` property so that users can treat anchors as links. -assert-property: (".src-line-numbers > a:nth-child(1)", { +assert-property: ("//a[@data-nosnippet and text()='1']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#1" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(2)", { +assert-property: ("//a[@data-nosnippet and text()='2']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#2" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(3)", { +assert-property: ("//a[@data-nosnippet and text()='3']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#3" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(4)", { +assert-property: ("//a[@data-nosnippet and text()='4']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#4" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(5)", { +assert-property: ("//a[@data-nosnippet and text()='5']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#5" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(6)", { +assert-property: ("//a[@data-nosnippet and text()='6']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#6" }, ENDS_WITH) // Assert that the line numbers text is aligned to the right. -assert-css: (".src-line-numbers", {"text-align": "right"}) +assert-css: ("a[data-nosnippet]", {"text-align": "right"}, ALL) // Now let's check that clicking on something else than the line number doesn't // do anything (and certainly not add a `#NaN` to the URL!). go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" // We use this assert-position to know where we will click. -assert-position: ("//*[@id='1']", {"x": 88, "y": 171}) -// We click on the left of the "1" anchor but still in the "src-line-number" `<pre>`. -click: (163, 77) +assert-position: ("//*[@id='1']", {"x": 81, "y": 169}) +// We click on the left of the "1" anchor but still in the `a[data-nosnippet]`. +click: (77, 163) assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH) // Checking the source code sidebar. |
