From cbcb74e939527750740b0c715068723f5a6e595c Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 8 Sep 2022 17:46:57 -0700 Subject: rustdoc: simplify the codeblock tooltip This commit moves the tooltip into example-wrap, simplifying allowing several overly-complex things to be fixed: * The mousover javascript can be removed, because hovering example-wrap can style the tooltip inside. * The sibling selecor can be removed, because hovering the tooltip also hovers the wrapper, which can hover the codeblock itself. * The relative positioning of the `
  • ` tag, which was added in e861efd9f9ca45c1048a256812dfe8faffbb1367 to fix the positioning of the code tooltip, can now be removed, because example-wrap itself already has relative positioning. --- src/test/rustdoc-gui/check_info_sign_position.goml | 8 ++--- src/test/rustdoc-gui/codeblock-tooltip.goml | 36 +++++++++++----------- .../rustdoc-gui/overflow-tooltip-information.goml | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/test') diff --git a/src/test/rustdoc-gui/check_info_sign_position.goml b/src/test/rustdoc-gui/check_info_sign_position.goml index 3bed7a0a03e..c249895503a 100644 --- a/src/test/rustdoc-gui/check_info_sign_position.goml +++ b/src/test/rustdoc-gui/check_info_sign_position.goml @@ -4,8 +4,8 @@ goto: file://|DOC_PATH|/test_docs/index.html goto: ./fn.check_list_code_block.html // If the codeblock is the first element of the docblock, the information tooltip must have // have some top margin to avoid going over the toggle (the "[+]"). -assert-css: (".docblock > .information > .compile_fail", { "margin-top": "16px" }) +assert-css: (".docblock > .example-wrap > .information > .compile_fail", { "margin-top": "16px" }) // Checks that the other codeblocks don't have this top margin. -assert-css: ("ol > li > .information > .compile_fail", { "margin-top": "0px" }) -assert-css: ("ol > li > .information > .ignore", { "margin-top": "0px" }) -assert-css: (".docblock > .information > .ignore", { "margin-top": "0px" }) +assert-css: ("ol > li > .example-wrap > .information > .compile_fail", { "margin-top": "0px" }) +assert-css: ("ol > li > .example-wrap > .information > .ignore", { "margin-top": "0px" }) +assert-css: (".docblock > .example-wrap > .information > .ignore", { "margin-top": "0px" }) diff --git a/src/test/rustdoc-gui/codeblock-tooltip.goml b/src/test/rustdoc-gui/codeblock-tooltip.goml index a0bb40fce8e..4e85c33c894 100644 --- a/src/test/rustdoc-gui/codeblock-tooltip.goml +++ b/src/test/rustdoc-gui/codeblock-tooltip.goml @@ -8,30 +8,30 @@ reload: // compile_fail block assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"}) -assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap pre.compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) move-cursor-to: ".docblock .information .compile_fail" assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"}) -assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap pre.compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"}) // should_panic block assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"}) -assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap pre.should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) move-cursor-to: ".docblock .information .should_panic" assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"}) -assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap pre.should_panic", {"border-left": "2px solid rgb(255, 0, 0)"}) // ignore block assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"}) -assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}) +assert-css: (".docblock .example-wrap pre.ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}) move-cursor-to: ".docblock .information .ignore" assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"}) -assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"}) +assert-css: (".docblock .example-wrap pre.ignore", {"border-left": "2px solid rgb(255, 142, 0)"}) // Light theme. @@ -39,30 +39,30 @@ local-storage: {"rustdoc-theme": "light"} reload: assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"}) -assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap pre.compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) move-cursor-to: ".docblock .information .compile_fail" assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"}) -assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap pre.compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"}) // should_panic block assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"}) -assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap pre.should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) move-cursor-to: ".docblock .information .should_panic" assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"}) -assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap pre.should_panic", {"border-left": "2px solid rgb(255, 0, 0)"}) // ignore block assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"}) -assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}) +assert-css: (".docblock .example-wrap pre.ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}) move-cursor-to: ".docblock .information .ignore" assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"}) -assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"}) +assert-css: (".docblock .example-wrap pre.ignore", {"border-left": "2px solid rgb(255, 142, 0)"}) // Ayu theme. @@ -70,27 +70,27 @@ local-storage: {"rustdoc-theme": "ayu"} reload: assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"}) -assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap pre.compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) move-cursor-to: ".docblock .information .compile_fail" assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"}) -assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap pre.compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"}) // should_panic block assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"}) -assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap pre.should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) move-cursor-to: ".docblock .information .should_panic" assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"}) -assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap pre.should_panic", {"border-left": "2px solid rgb(255, 0, 0)"}) // ignore block assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"}) -assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}) +assert-css: (".docblock .example-wrap pre.ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}) move-cursor-to: ".docblock .information .ignore" assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"}) -assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"}) +assert-css: (".docblock .example-wrap pre.ignore", {"border-left": "2px solid rgb(255, 142, 0)"}) diff --git a/src/test/rustdoc-gui/overflow-tooltip-information.goml b/src/test/rustdoc-gui/overflow-tooltip-information.goml index 7ef85a4c445..5be1aff8d3b 100644 --- a/src/test/rustdoc-gui/overflow-tooltip-information.goml +++ b/src/test/rustdoc-gui/overflow-tooltip-information.goml @@ -2,7 +2,7 @@ // have overflow and max-width CSS rules set because they create a bug in firefox on // mac. For more information: https://github.com/rust-lang/rust/issues/89185 goto: file://|DOC_PATH|/test_docs/fn.foo.html -assert-css: (".docblock > .information", { +assert-css: (".docblock > .example-wrap > .information", { "overflow-x": "visible", "max-width": "none" }, ALL) -- cgit 1.4.1-3-g733a5