]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #106110 - GuillaumeGomez:toggle-line-background, r=notriddle
authorbors <bors@rust-lang.org>
Sat, 24 Dec 2022 20:23:45 +0000 (20:23 +0000)
committerbors <bors@rust-lang.org>
Sat, 24 Dec 2022 20:23:45 +0000 (20:23 +0000)
Migrate toggle-line-inner background to CSS variable

r? `@notriddle`

1  2 
src/librustdoc/html/static/css/rustdoc.css
src/librustdoc/html/static/css/themes/ayu.css
src/librustdoc/html/static/css/themes/dark.css
src/librustdoc/html/static/css/themes/light.css
src/test/rustdoc-gui/scrape-examples-toggle.goml

index a0b696ee3363d970acd8f59b62f569ec6b882903,9bb338d7129ce1892223afa06172540f15ab7a0a..8c84fbc0c30568d121d08aa2a289697d7b10c451
@@@ -1,10 -1,45 +1,46 @@@
 +// This tests checks that the "scraped examples" toggle is working as expected.
  goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
  
- // Clicking "More examples..." will open additional examples
- assert-attribute-false: (".more-examples-toggle", {"open": ""})
- click: ".more-examples-toggle"
- assert-attribute: (".more-examples-toggle", {"open": ""})
+ // Checking the color of the toggle line.
+ show-text: true
+ define-function: (
+     "check-color",
+     (theme, toggle_line_color, toggle_line_hover_color),
+     [
+         ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
+         ("reload"),
+         // Clicking "More examples..." will open additional examples
+         ("assert-attribute-false", (".more-examples-toggle", {"open": ""})),
+         ("click", ".more-examples-toggle"),
+         ("assert-attribute", (".more-examples-toggle", {"open": ""})),
+         ("assert-css", (".toggle-line-inner", {"background-color": |toggle_line_color|}, ALL)),
+         ("move-cursor-to", ".toggle-line"),
+         ("assert-css", (
+             ".toggle-line:hover .toggle-line-inner",
+             {"background-color": |toggle_line_hover_color|},
+         )),
+         // Moving cursor away from the toggle line to prevent disrupting next test.
+         ("move-cursor-to", ".search-input"),
+     ],
+ )
+ call-function: ("check-color", {
+     "theme": "ayu",
+     "toggle_line_color": "rgb(153, 153, 153)",
+     "toggle_line_hover_color": "rgb(197, 197, 197)",
+ })
+ call-function: ("check-color", {
+     "theme": "dark",
+     "toggle_line_color": "rgb(153, 153, 153)",
+     "toggle_line_hover_color": "rgb(197, 197, 197)",
+ })
+ call-function: ("check-color", {
+     "theme": "light",
+     "toggle_line_color": "rgb(204, 204, 204)",
+     "toggle_line_hover_color": "rgb(153, 153, 153)",
+ })
  
  // Toggling all docs will close additional examples
  click: "#toggle-all-docs"