|
| 1 | +// Test that the "hide deprecated" setting is correctly handled. |
| 2 | + |
| 3 | +include: "utils.goml" |
| 4 | + |
| 5 | +go-to: "file://" + |DOC_PATH| + "/lib2/deprecated/index.html" |
| 6 | + |
| 7 | +// There should be two deprecated items listed on the module page: |
| 8 | +// `DeprecatedStruct` and `DeprecatedTrait`. |
| 9 | +assert-count: ("dt.deprecated", 2) |
| 10 | +// `DeprecatedStruct` and `DeprecatedTrait` should be displayed for now. |
| 11 | +assert-css: ("dt.deprecated", {"display": "block"}, ALL) |
| 12 | + |
| 13 | +// We enable the "hide deprecated items" setting. |
| 14 | +call-function: ("open-settings-menu", {}) |
| 15 | +click: "#hide-deprecated-items" |
| 16 | +// None of them should be displayed anymore. |
| 17 | +wait-for-css: ("dt.deprecated", {"display": "none"}, ALL) |
| 18 | + |
| 19 | +// We disable the setting. |
| 20 | +click: "#hide-deprecated-items" |
| 21 | +// All of them should be displayed back. |
| 22 | +wait-for-css: ("dt.deprecated", {"display": "block"}, ALL) |
| 23 | + |
| 24 | +// Now we go to a trait with a deprecated method and a deprecated associated const. |
| 25 | +go-to: "file://" + |DOC_PATH| + "/lib2/deprecated/trait.NormalTrait.html" |
| 26 | + |
| 27 | +// There should be two deprecated items. |
| 28 | +assert-count: ("details.deprecated", 2) |
| 29 | +// They should be displayed for now. |
| 30 | +assert-css: ("details.deprecated", {"display": "block"}, ALL) |
| 31 | + |
| 32 | +// We enable the "hide deprecated items" setting. |
| 33 | +call-function: ("open-settings-menu", {}) |
| 34 | +click: "#hide-deprecated-items" |
| 35 | + |
| 36 | +// They shouldn't be displayed anymore. |
| 37 | +wait-for-css: ("details.deprecated", {"display": "none"}, ALL) |
| 38 | + |
| 39 | +// We disable the setting. |
| 40 | +click: "#hide-deprecated-items" |
| 41 | +// All of them should be displayed back. |
| 42 | +wait-for-css: ("details.deprecated", {"display": "block"}, ALL) |
| 43 | + |
| 44 | +// We now go to a struct with a deprecated method which implements a deprecated trait and a trait |
| 45 | +// with deprecated associated items. |
| 46 | +go-to: "file://" + |DOC_PATH| + "/lib2/deprecated/struct.NonDeprecatedStruct.html" |
| 47 | + |
| 48 | +// There should be five deprecated items... |
| 49 | +assert-count: ("details.deprecated", 5) |
| 50 | +// One of which being a deprecated impl because the trait itself is deprecated. |
| 51 | +assert-count: ("details.implementors-toggle.deprecated", 1) |
| 52 | +// They should all be displayed for now. |
| 53 | +assert-css: ("details.deprecated", {"display": "block"}, ALL) |
| 54 | + |
| 55 | +// We enable the "hide deprecated items" setting. |
| 56 | +call-function: ("open-settings-menu", {}) |
| 57 | +click: "#hide-deprecated-items" |
| 58 | + |
| 59 | +// They shouldn't be displayed anymore. |
| 60 | +wait-for-css: ("details.deprecated", {"display": "none"}, ALL) |
| 61 | + |
| 62 | +// We disable the setting. |
| 63 | +click: "#hide-deprecated-items" |
| 64 | +// All of them should be displayed back. |
| 65 | +wait-for-css: ("details.deprecated", {"display": "block"}, ALL) |
| 66 | + |
| 67 | +// And now we check with the search results. |
| 68 | +call-function: ("perform-search", {"query": "deprecated::depr"}) |
| 69 | +// There should at least 7 results. |
| 70 | +store-count: ("#results ul.search-results.active > a", nb_search_results) |
| 71 | +assert: |nb_search_results| >= 7 |
| 72 | +// There should be at least 5 deprecated items. |
| 73 | +store-count: ("#results ul.search-results.active > a.deprecated", nb_deprecated_results) |
| 74 | +assert: |nb_search_results| >= 5 |
| 75 | +// Deprecated items should all be displayed. |
| 76 | +assert-css: ("#results ul.search-results.active > a.deprecated", {"display": "grid"}, ALL) |
| 77 | +// We enable the "hide deprecated items" setting. |
| 78 | +call-function: ("open-settings-menu", {}) |
| 79 | +click: "#hide-deprecated-items" |
| 80 | +// None of them should be displayed anymore. |
| 81 | +wait-for-css: ("#results ul.search-results.active > a.deprecated", {"display": "none"}, ALL) |
0 commit comments