]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-gui/search-tab-change-title-fn-sig.goml
Rollup merge of #106717 - klensy:typo, r=lcnr
[rust.git] / tests / rustdoc-gui / search-tab-change-title-fn-sig.goml
1 // Checks that the search tab results work correctly with function signature syntax
2 // First, try a search-by-name
3 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
4 write: (".search-input", "Foo")
5 // To be SURE that the search will be run.
6 press-key: 'Enter'
7 // Waiting for the search results to appear...
8 wait-for: "#search-tabs"
9 assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
10 assert-text: ("#search-tabs > button:nth-of-type(1)", "In Names", STARTS_WITH)
11 assert: "input.search-input:focus"
12 // Use left-right keys
13 press-key: "ArrowDown"
14 assert: "#results > .search-results.active > a:nth-of-type(1):focus"
15 press-key: "ArrowRight"
16 wait-for-attribute: ("#search-tabs > button:nth-of-type(2)", {"class": "selected"})
17 press-key: "ArrowRight"
18 wait-for-attribute: ("#search-tabs > button:nth-of-type(3)", {"class": "selected"})
19 press-key: "ArrowRight"
20 wait-for-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
21 press-key: "ArrowLeft"
22 wait-for-attribute: ("#search-tabs > button:nth-of-type(3)", {"class": "selected"})
23
24 // Now try search-by-return
25 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
26 write: (".search-input", "-> String")
27 // To be SURE that the search will be run.
28 press-key: 'Enter'
29 // Waiting for the search results to appear...
30 wait-for: "#search-tabs"
31 assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
32 assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Return Types", STARTS_WITH)
33 assert: "input.search-input:focus"
34 // Use left-right keys
35 press-key: "ArrowDown"
36 assert: "#results > .search-results.active > a:nth-of-type(1):focus"
37 press-key: "ArrowRight"
38 wait-for-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
39 press-key: "ArrowRight"
40 wait-for-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
41 press-key: "ArrowRight"
42 wait-for-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
43 press-key: "ArrowLeft"
44 wait-for-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
45
46 // Try with a search-by-return with no results
47 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
48 write: (".search-input", "-> Something")
49 // To be SURE that the search will be run.
50 press-key: 'Enter'
51 // Waiting for the search results to appear...
52 wait-for: "#search-tabs"
53 assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
54 assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Return Types", STARTS_WITH)
55
56 // Try with a search-by-parameter
57 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
58 write: (".search-input", "usize pattern")
59 // To be SURE that the search will be run.
60 press-key: 'Enter'
61 // Waiting for the search results to appear...
62 wait-for: "#search-tabs"
63 assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
64 assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Parameters", STARTS_WITH)
65
66 // Try with a search-by-parameter-and-return
67 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
68 write: (".search-input", "pattern -> str")
69 // To be SURE that the search will be run.
70 press-key: 'Enter'
71 // Waiting for the search results to appear...
72 wait-for: "#search-tabs"
73 assert-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected"})
74 assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Signatures", STARTS_WITH)