|
| 1 | +// This test ensures that the color of the items in the type decl are working as expected. |
| 2 | +define-function: ( |
| 3 | + "check-colors", |
| 4 | + ( |
| 5 | + theme, |
| 6 | + attr_color, |
| 7 | + trait_color, |
| 8 | + struct_color, |
| 9 | + enum_color, |
| 10 | + primitive_color, |
| 11 | + constant_color, |
| 12 | + fn_color, |
| 13 | + assoc_type_color, |
| 14 | + ), |
| 15 | + [ |
| 16 | + ("goto", "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html"), |
| 17 | + ("show-text", true), |
| 18 | + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), |
| 19 | + ("reload"), |
| 20 | + ("assert-css", (".item-decl .code-attribute", {"color": |attr_color|}, ALL)), |
| 21 | + ("assert-css", (".item-decl .trait", {"color": |trait_color|}, ALL)), |
| 22 | + // We need to add `code` here because otherwise it would select the parent too. |
| 23 | + ("assert-css", (".item-decl code .struct", {"color": |struct_color|}, ALL)), |
| 24 | + ("assert-css", (".item-decl .enum", {"color": |enum_color|}, ALL)), |
| 25 | + ("assert-css", (".item-decl .primitive", {"color": |primitive_color|}, ALL)), |
| 26 | + ("goto", "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html"), |
| 27 | + ("assert-css", (".item-decl .constant", {"color": |constant_color|}, ALL)), |
| 28 | + ("assert-css", (".item-decl .fnname", {"color": |fn_color|}, ALL)), |
| 29 | + ("assert-css", (".item-decl .associatedtype", {"color": |assoc_type_color|}, ALL)), |
| 30 | + ], |
| 31 | +) |
| 32 | + |
| 33 | +call-function: ( |
| 34 | + "check-colors", |
| 35 | + { |
| 36 | + "theme": "ayu", |
| 37 | + "attr_color": "rgb(153, 153, 153)", |
| 38 | + "trait_color": "rgb(57, 175, 215)", |
| 39 | + "struct_color": "rgb(255, 160, 165)", |
| 40 | + "enum_color": "rgb(255, 160, 165)", |
| 41 | + "primitive_color": "rgb(255, 160, 165)", |
| 42 | + "constant_color": "rgb(57, 175, 215)", |
| 43 | + "fn_color": "rgb(253, 214, 135)", |
| 44 | + "assoc_type_color": "rgb(57, 175, 215)", |
| 45 | + }, |
| 46 | +) |
| 47 | +call-function: ( |
| 48 | + "check-colors", |
| 49 | + { |
| 50 | + "theme": "dark", |
| 51 | + "attr_color": "rgb(153, 153, 153)", |
| 52 | + "trait_color": "rgb(183, 140, 242)", |
| 53 | + "struct_color": "rgb(45, 191, 184)", |
| 54 | + "enum_color": "rgb(45, 191, 184)", |
| 55 | + "primitive_color": "rgb(45, 191, 184)", |
| 56 | + "constant_color": "rgb(210, 153, 29)", |
| 57 | + "fn_color": "rgb(43, 171, 99)", |
| 58 | + "assoc_type_color": "rgb(210, 153, 29)", |
| 59 | + }, |
| 60 | +) |
| 61 | +call-function: ( |
| 62 | + "check-colors", |
| 63 | + { |
| 64 | + "theme": "light", |
| 65 | + "attr_color": "rgb(153, 153, 153)", |
| 66 | + "trait_color": "rgb(110, 79, 201)", |
| 67 | + "struct_color": "rgb(173, 55, 138)", |
| 68 | + "enum_color": "rgb(173, 55, 138)", |
| 69 | + "primitive_color": "rgb(173, 55, 138)", |
| 70 | + "constant_color": "rgb(56, 115, 173)", |
| 71 | + "fn_color": "rgb(173, 124, 55)", |
| 72 | + "assoc_type_color": "rgb(56, 115, 173)", |
| 73 | + }, |
| 74 | +) |
0 commit comments