fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// This test is to ensure that the anchors (`§`) have the expected color and position. 2 3define-function: ( 4 "check-colors", 5 (theme, main_color, title_color, main_heading_color, main_heading_type_color, src_link_color, sidebar_link_color), 6 block { 7 go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" 8 // This is needed to ensure that the text color is computed. 9 show-text: true 10 11 // Setting the theme. 12 set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} 13 // We reload the page so the local storage settings are being used. 14 reload: 15 16 assert-css: ("#toggle-all-docs", {"color": |main_color|}) 17 assert-css: (".main-heading h1 a:nth-of-type(1)", {"color": |main_heading_color|}) 18 assert-css: (".main-heading a:nth-of-type(2)", {"color": |main_heading_type_color|}) 19 assert-css: ( 20 ".rightside a.src", 21 {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|}, 22 ALL, 23 ) 24 compare-elements-css: ( 25 ".rightside a.src", 26 "a.rightside.src", 27 ["color", "text-decoration"], 28 ) 29 compare-elements-css: ( 30 ".main-heading a.src", 31 "a.rightside.src", 32 ["color", "text-decoration"], 33 ) 34 35 move-cursor-to: ".main-heading a.src" 36 assert-css: ( 37 ".main-heading a.src", 38 {"color": |src_link_color|, "text-decoration": "underline solid " + |src_link_color|}, 39 ) 40 move-cursor-to: ".impl-items .rightside a.src" 41 assert-css: ( 42 ".impl-items .rightside a.src", 43 {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|}, 44 ) 45 move-cursor-to: ".impl-items a.rightside.src" 46 assert-css: ( 47 ".impl-items a.rightside.src", 48 {"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|}, 49 ) 50 51 go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" 52 // Since we changed page, we need to set the theme again. 53 set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} 54 // We reload the page so the local storage settings are being used. 55 reload: 56 57 assert-css: ("#top-doc-prose-title", {"color": |title_color|}) 58 59 assert-css: (".sidebar a", {"color": |sidebar_link_color|}) 60 assert-css: (".main-heading h1 a", {"color": |title_color|}) 61 62 // We move the cursor over the "Implementations" title so the anchor is displayed. 63 move-cursor-to: "h2#implementations" 64 assert-css: ("h2#implementations a.anchor", {"color": |main_color|}) 65 66 // Same thing with the impl block title. 67 move-cursor-to: "#impl-HeavilyDocumentedStruct" 68 assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": |main_color|}) 69 70 assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"}) 71 }, 72) 73 74call-function: ( 75 "check-colors", 76 { 77 "theme": "ayu", 78 "main_color": "#c5c5c5", 79 "title_color": "#fff", 80 "main_heading_color": "#fff", 81 "main_heading_type_color": "#ffa0a5", 82 "src_link_color": "#39afd7", 83 "sidebar_link_color": "#53b1db", 84 }, 85) 86call-function: ( 87 "check-colors", 88 { 89 "theme": "dark", 90 "main_color": "#ddd", 91 "title_color": "#ddd", 92 "main_heading_color": "#ddd", 93 "main_heading_type_color": "#2dbfb8", 94 "src_link_color": "#d2991d", 95 "sidebar_link_color": "#fdbf35", 96 }, 97) 98call-function: ( 99 "check-colors", 100 { 101 "theme": "light", 102 "main_color": "black", 103 "title_color": "black", 104 "main_heading_color": "black", 105 "main_heading_type_color": "#ad378a", 106 "src_link_color": "#3873ad", 107 "sidebar_link_color": "#356da4", 108 }, 109)