Skip to content

Commit

Permalink
rustdoc: hide modals when resizing the sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Jan 8, 2024
1 parent 0ee9cfd commit 8b52275
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1721,6 +1721,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
}
currentPointerId = e.pointerId;
}
window.hideAllModals(false);
e.preventDefault();
window.addEventListener("pointermove", resize, false);
window.addEventListener("pointercancel", stopResize, false);
Expand Down
20 changes: 20 additions & 0 deletions tests/rustdoc-gui/sidebar-resize-close-popover.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Checks sidebar resizing close the Settings popover
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
show-text: true
click: "#settings-menu"
wait-for: "#settings"
assert-css: ("#settings", {"display": "block"})
// normal resizing
drag-and-drop: ((205, 100), (185, 100))
assert-property: (".sidebar", {"clientWidth": "182"})
assert-css: ("#settings", {"display": "none"})

// Now same thing, but for source code
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
click: "#settings-menu"
wait-for: "#settings"
assert-css: ("#settings", {"display": "block"})
assert-property: (".sidebar", {"clientWidth": "49"})
drag-and-drop: ((52, 100), (185, 100))
assert-css: ("#settings", {"display": "none"})

0 comments on commit 8b52275

Please sign in to comment.