Skip to content

Commit de51b0d

Browse files
committed
rustdoc-search: add test case for "About this result" popover
1 parent 3dca81d commit de51b0d

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Check the "About this Result" popover.
2+
// Try a complex result.
3+
go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=scroll_traits::Iterator<T>,(T->bool)->(Extend<T>,Extend<T>)"
4+
5+
// These two commands are used to be sure the search will be run.
6+
focus: ".search-input"
7+
press-key: "Enter"
8+
9+
wait-for: "#search-tabs"
10+
assert-count: ("#search-tabs button", 1)
11+
assert-count: (".search-results > li", 1)
12+
assert-count: (".tooltip:not(.popover)", 1)
13+
assert-count: (".tooltip.popover", 0)
14+
15+
assert: "//div[@class='type-signature']/strong[text()='Iterator']"
16+
assert: "//div[@class='type-signature']/strong[text()='(']"
17+
assert: "//div[@class='type-signature']/strong[text()=')']"
18+
19+
click: ".tooltip:not(.popover)"
20+
wait-for: ".tooltip.popover"
21+
assert-count: (".tooltip.popover", 1)
22+
23+
assert: "//div[@class='tooltip popover']//strong[text()='FnMut']"
24+
assert: "//div[@class='tooltip popover']//strong[text()='Iterator::Item']"
25+
assert: "//div[@class='tooltip popover']//strong[text()='bool']"
26+
assert: "//div[@class='tooltip popover']//strong[text()='Extend']"
27+
28+
assert-text: (".tooltip.popover h3", "About this result")
29+
assert-text: (".tooltip.popover pre code div:nth-child(1)", "Iterator::Item is T")
30+
assert-text: (".tooltip.popover pre code div:nth-child(2)", "F: FnMut (&Iterator::Item) -> bool")
31+
assert-text: (".tooltip.popover pre code div:nth-child(3)", "B: Default + Extend<Iterator::Item>")
32+
33+
click: ".tooltip:not(.popover)"
34+
wait-for: 100 // wait-for-false does not exist
35+
assert-count: (".tooltip.popover", 0)
36+
37+
// Try a simple result that *won't* give an info box.
38+
go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=F->lib2::WhereWhitespace<T>"
39+
40+
// These two commands are used to be sure the search will be run.
41+
focus: ".search-input"
42+
press-key: "Enter"
43+
44+
wait-for: "#search-tabs"
45+
assert-text: ("//div[@class='type-signature']", "F -> WhereWhitespace<T>")
46+
assert-count: ("#search-tabs button", 1)
47+
assert-count: (".search-results > li", 1)
48+
assert-count: (".tooltip:not(.popover)", 0)
49+
assert-count: (".tooltip.popover", 0)
50+
51+
assert: "//div[@class='type-signature']/strong[text()='F']"
52+
assert: "//div[@class='type-signature']/strong[text()='WhereWhitespace']"
53+
assert: "//div[@class='type-signature']/strong[text()='T']"

0 commit comments

Comments
 (0)