From 212d03dadca627e55273294404bcc6312aa65969 Mon Sep 17 00:00:00 2001 From: Will Crichton Date: Tue, 6 Dec 2022 09:59:49 -0800 Subject: [PATCH] Factor scrape-examples toggle test into a new file --- ...goml => scrape-examples-button-focus.goml} | 13 ---------- .../rustdoc-gui/scrape-examples-toggle.goml | 14 +++++++++++ .../src/scrape_examples/examples/check2.rs | 25 ------------------- 3 files changed, 14 insertions(+), 38 deletions(-) rename src/test/rustdoc-gui/{scrape-examples-interactions.goml => scrape-examples-button-focus.goml} (71%) create mode 100644 src/test/rustdoc-gui/scrape-examples-toggle.goml delete mode 100644 src/test/rustdoc-gui/src/scrape_examples/examples/check2.rs diff --git a/src/test/rustdoc-gui/scrape-examples-interactions.goml b/src/test/rustdoc-gui/scrape-examples-button-focus.goml similarity index 71% rename from src/test/rustdoc-gui/scrape-examples-interactions.goml rename to src/test/rustdoc-gui/scrape-examples-button-focus.goml index f7b43c4c85b..bba518db099 100644 --- a/src/test/rustdoc-gui/scrape-examples-interactions.goml +++ b/src/test/rustdoc-gui/scrape-examples-button-focus.goml @@ -27,16 +27,3 @@ store-property: (fullOffsetHeight, ".scraped-example-list > .scraped-example pre assert-property: (".scraped-example-list > .scraped-example pre", { "scrollHeight": |fullOffsetHeight| }) - -// Clicking "More examples..." will open additional examples -assert-attribute-false: (".more-examples-toggle", {"open": ""}) -click: ".more-examples-toggle" -assert-attribute: (".more-examples-toggle", {"open": ""}) - -// Toggling all docs will close additional examples -click: "#toggle-all-docs" -assert-attribute-false: (".more-examples-toggle", {"open": ""}) - -// After re-opening the docs, the additional examples should stay closed -click: "#toggle-all-docs" -assert-attribute-false: (".more-examples-toggle", {"open": ""}) diff --git a/src/test/rustdoc-gui/scrape-examples-toggle.goml b/src/test/rustdoc-gui/scrape-examples-toggle.goml new file mode 100644 index 00000000000..ee720afb788 --- /dev/null +++ b/src/test/rustdoc-gui/scrape-examples-toggle.goml @@ -0,0 +1,14 @@ +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": ""}) + +// Toggling all docs will close additional examples +click: "#toggle-all-docs" +assert-attribute-false: (".more-examples-toggle", {"open": ""}) + +// After re-opening the docs, the additional examples should stay closed +click: "#toggle-all-docs" +assert-attribute-false: (".more-examples-toggle", {"open": ""}) diff --git a/src/test/rustdoc-gui/src/scrape_examples/examples/check2.rs b/src/test/rustdoc-gui/src/scrape_examples/examples/check2.rs deleted file mode 100644 index 3e69c6086ae..00000000000 --- a/src/test/rustdoc-gui/src/scrape_examples/examples/check2.rs +++ /dev/null @@ -1,25 +0,0 @@ -fn main() { - for i in 0..9 { - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - } - scrape_examples::test(); - for i in 0..9 { - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - println!("hello world!"); - } -}