Skip to content

Commit

Permalink
Rollup merge of rust-lang#137539 - GuillaumeGomez:copy-content-tests,…
Browse files Browse the repository at this point in the history
… r=notriddle

 Add rustdoc-gui regression test for rust-lang#137082

Fixes rust-lang#137082.

Added new commands in `browser-ui-test` allowing us to add a regression test for rust-lang#137082 and also another to copy code examples content.

r? `@notriddle`
  • Loading branch information
fmease authored Feb 25, 2025
2 parents 1d0e1c3 + 592028a commit 8462d56
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.20.2
0.20.3
2 changes: 2 additions & 0 deletions tests/rustdoc-gui/code-example-buttons.goml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ click: ".example-wrap .copy-button"
move-cursor-to: ".search-input"
assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0)
assert-css: (".example-wrap .copy-button", { "visibility": "hidden" })
// Since we clicked on the copy button, the clipboard content should have been updated.
assert-clipboard: 'println!("nothing fancy");\nprintln!("but with two lines!");'

define-function: (
"check-buttons",
Expand Down
9 changes: 7 additions & 2 deletions tests/rustdoc-gui/copy-path.goml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// Checks that the "copy path" button is not triggering JS error and its display
// isn't broken.
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
// isn't broken and the copied path is as expected.
go-to: "file://" + |DOC_PATH| + "/test_docs/foreign_impl_order/trait.Foo.html"

// We ensure that the clipboard is empty.
assert-clipboard: ""

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

0 comments on commit 8462d56

Please sign in to comment.