rust/tests/rustdoc-gui/scrape-examples-button-focus.goml
Michael Howell 2c4922cf29 rustdoc: use better, consistent SVG icons for scraped examples
This continues two ongoing projects:

- Replacing ascii art with real icons that don't look like
  syntax, are understandable to people who're familiar with
  desktop computers and smart devices, and aren't ugly.
- Using labels and tooltips to clarify these icons, when the
  limits of popular iconography hit us. In this case, I've added
  tooltips, because, unfortunately, there's not room for
  always-visible labels.
2025-02-12 16:07:11 -07:00

47 lines
1.8 KiB
Text

// This test ensures that the scraped examples buttons are working as expecting
// when 'Enter' key is pressed when they're focused.
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
// The next/prev buttons vertically scroll the code viewport between examples
move-cursor-to: ".scraped-example-list > .scraped-example"
wait-for: ".scraped-example-list > .scraped-example .next"
store-value: (initialScrollTop, 250)
assert-property: (".scraped-example-list > .scraped-example .rust", {
"scrollTop": |initialScrollTop|,
}, NEAR)
focus: ".scraped-example-list > .scraped-example .next"
press-key: "Enter"
assert-property-false: (".scraped-example-list > .scraped-example .rust", {
"scrollTop": |initialScrollTop|
}, NEAR)
focus: ".scraped-example-list > .scraped-example .prev"
press-key: "Enter"
assert-property: (".scraped-example-list > .scraped-example .rust", {
"scrollTop": |initialScrollTop|
}, NEAR)
// Make sure all the buttons are the same size
store-property: (".scraped-example-list > .scraped-example .prev", {
"offsetWidth": buttonWidth,
"offsetHeight": buttonHeight,
})
assert-property: (".scraped-example-list > .scraped-example .prev", {
"offsetWidth": |buttonWidth|,
"offsetHeight": |buttonHeight|,
"title": "Previous usage",
})
assert-property: (".scraped-example-list > .scraped-example .next", {
"offsetWidth": |buttonWidth|,
"offsetHeight": |buttonHeight|,
"title": "Next usage",
})
assert-property: (".scraped-example-list > .scraped-example .expand", {
"offsetWidth": |buttonWidth|,
"offsetHeight": |buttonHeight|,
"title": "Show all",
})
assert-property: (".scraped-example-list > .scraped-example .copy-button", {
"offsetWidth": |buttonWidth|,
"offsetHeight": |buttonHeight|,
"title": "Copy code to clipboard",
})