Skip to content

Commit 8462d56

Browse files
authoredFeb 25, 2025
Rollup merge of #137539 - GuillaumeGomez:copy-content-tests, r=notriddle
Add rustdoc-gui regression test for #137082 Fixes #137082. Added new commands in `browser-ui-test` allowing us to add a regression test for #137082 and also another to copy code examples content. r? `@notriddle`
2 parents 1d0e1c3 + 592028a commit 8462d56

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.20.2
1+
0.20.3

‎tests/rustdoc-gui/code-example-buttons.goml

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ click: ".example-wrap .copy-button"
2626
move-cursor-to: ".search-input"
2727
assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0)
2828
assert-css: (".example-wrap .copy-button", { "visibility": "hidden" })
29+
// Since we clicked on the copy button, the clipboard content should have been updated.
30+
assert-clipboard: 'println!("nothing fancy");\nprintln!("but with two lines!");'
2931

3032
define-function: (
3133
"check-buttons",

‎tests/rustdoc-gui/copy-path.goml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
// Checks that the "copy path" button is not triggering JS error and its display
2-
// isn't broken.
3-
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
2+
// isn't broken and the copied path is as expected.
3+
go-to: "file://" + |DOC_PATH| + "/test_docs/foreign_impl_order/trait.Foo.html"
4+
5+
// We ensure that the clipboard is empty.
6+
assert-clipboard: ""
47

58
// First we store the size of the button before we click on it.
69
store-size: ("#copy-path", {"width": width, "height": height})
710
click: "#copy-path"
811
// We wait for the new text to appear.
912
wait-for: "#copy-path.clicked"
13+
// We check that the clipboard value is the expected one.
14+
assert-clipboard: "test_docs::foreign_impl_order::Foo"
1015
// We check that the size didn't change.
1116
assert-size: ("#copy-path.clicked", {"width": |width|, "height": |height|})
1217
// We wait for the button to turn back to its original state.

0 commit comments

Comments
 (0)
Please sign in to comment.