diff options
| author | bors <bors@rust-lang.org> | 2024-07-28 18:49:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-28 18:49:55 +0000 |
| commit | 2cbbe8b8bb2be672b14cf741a2f0ec24a49f3f0b (patch) | |
| tree | 2b2d6044bc2153a15d65e9ae7abd307f52c9adef /tests/rustdoc-gui | |
| parent | 188ddf4d6a694fa263c2ff8be8f8eade659599d6 (diff) | |
| parent | eeb76ccaf0f20819c1e4360420e7b1aff94c5c9d (diff) | |
| download | rust-2cbbe8b8bb2be672b14cf741a2f0ec24a49f3f0b.tar.gz rust-2cbbe8b8bb2be672b14cf741a2f0ec24a49f3f0b.zip | |
Auto merge of #128313 - GuillaumeGomez:rollup-kacb489, r=GuillaumeGomez
Rollup of 6 pull requests Successful merges: - #125779 ([rustdoc] Add copy code feature) - #127765 (Fix doc nits) - #127860 (deps: dedup object, wasmparser, wasm-encoder) - #128103 (add `is_multiple_of` for unsigned integer types) - #128228 (Stabilize `const_waker`) - #128240 (Add links from `assert_eq!` docs to `debug_assert_eq!`, etc.) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests/rustdoc-gui')
| -rw-r--r-- | tests/rustdoc-gui/copy-code.goml | 54 | ||||
| -rw-r--r-- | tests/rustdoc-gui/run-on-hover.goml | 8 |
2 files changed, 58 insertions, 4 deletions
diff --git a/tests/rustdoc-gui/copy-code.goml b/tests/rustdoc-gui/copy-code.goml new file mode 100644 index 00000000000..72a5bece175 --- /dev/null +++ b/tests/rustdoc-gui/copy-code.goml @@ -0,0 +1,54 @@ +// Checks that the "copy code" button is not triggering JS error and its display +// isn't broken. +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" + +define-function: ( + "check-copy-button", + [], + block { + // First we ensure that there are no "copy code" currently existing. + assert-count: (".example-wrap .copy-button", 0) + move-cursor-to: ".example-wrap" + assert-count: (".example-wrap .copy-button", 1) + // We now ensure it's only displayed when the example is hovered. + assert-css: (".example-wrap .copy-button", { "visibility": "visible" }) + move-cursor-to: ".search-input" + assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) + // Checking that the copy button has the same size as the "copy path" button. + compare-elements-size: ( + "#copy-path", + ".example-wrap:nth-of-type(1) .copy-button", + ["height", "width"], + ) + }, +) + +call-function: ("check-copy-button", {}) +// Checking that the run button and the copy button have the same height. +compare-elements-size: ( + ".example-wrap:nth-of-type(1) .test-arrow", + ".example-wrap:nth-of-type(1) .copy-button", + ["height"], +) +// ... and the same y position. +compare-elements-position: ( + ".example-wrap:nth-of-type(1) .test-arrow", + ".example-wrap:nth-of-type(1) .copy-button", + ["y"], +) +store-size: (".example-wrap:nth-of-type(1) .copy-button", { + "height": copy_height, + "width": copy_width, +}) +assert: |copy_height| > 0 && |copy_width| > 0 + +// Checking same things for the copy button when there is no run button. +go-to: "file://" + |DOC_PATH| + "/lib2/sub_mod/struct.Foo.html" +call-function: ("check-copy-button", {}) +// Ensure there is no run button. +assert-count: (".example-wrap .test-arrow", 0) +// Check it's the same size without a run button. +assert-size: (".example-wrap:nth-of-type(1) .copy-button", { + "height": |copy_height|, + "width": |copy_width|, +}) diff --git a/tests/rustdoc-gui/run-on-hover.goml b/tests/rustdoc-gui/run-on-hover.goml index 087dd3374f8..b62da79b780 100644 --- a/tests/rustdoc-gui/run-on-hover.goml +++ b/tests/rustdoc-gui/run-on-hover.goml @@ -17,16 +17,16 @@ define-function: ( "visibility": "visible", "color": |color|, "background-color": |background|, - "font-size": "22px", - "border-radius": "5px", + "font-size": "16px", + "border-radius": "2px", }) move-cursor-to: ".test-arrow" assert-css: (".test-arrow:hover", { "visibility": "visible", "color": |hover_color|, "background-color": |hover_background|, - "font-size": "22px", - "border-radius": "5px", + "font-size": "16px", + "border-radius": "2px", }) }, ) |
