11// This tests basic search behavior.
22
33fail-on-js-error: true
4- go-to: |DOC_PATH| + "test_book /index.html"
4+ go-to: |DOC_PATH| + "search /index.html"
55
66define-function: (
77 "open-search",
@@ -15,23 +15,23 @@ define-function: (
1515
1616call-function: ("open-search", {})
1717assert-text: ("#mdbook-searchresults-header", "")
18- write: "strikethrough "
19- wait-for-text: ("#mdbook-searchresults-header", "2 search results for 'strikethrough ':")
18+ write: "extraordinary "
19+ wait-for-text: ("#mdbook-searchresults-header", "2 search results for 'extraordinary ':")
2020// Close the search display
2121press-key: 'Escape'
2222wait-for-css: ("#mdbook-search-wrapper", {"display": "none"})
2323// Reopening the search should show the last value
2424call-function: ("open-search", {})
25- assert-text: ("#mdbook-searchresults-header", "2 search results for 'strikethrough ':")
25+ assert-text: ("#mdbook-searchresults-header", "2 search results for 'extraordinary ':")
2626// Navigate to a sub-chapter
27- go-to: "./individual/strikethrough .html"
27+ go-to: "./inner/chapter_2 .html"
2828assert-text: ("#mdbook-searchresults-header", "")
2929call-function: ("open-search", {})
30- write: "strikethrough "
31- wait-for-text: ("#mdbook-searchresults-header", "2 search results for 'strikethrough ':")
30+ write: "kaleidoscope "
31+ wait-for-text: ("#mdbook-searchresults-header", "2 search results for 'kaleidoscope ':")
3232
3333// Now we test search shortcuts and more page changes.
34- go-to: |DOC_PATH| + "test_book /index.html"
34+ go-to: |DOC_PATH| + "search /index.html"
3535
3636// This check is to ensure that the search bar is inside the search wrapper.
3737assert: "#mdbook-search-wrapper #mdbook-searchbar"
@@ -56,18 +56,18 @@ wait-for-css: ("#mdbook-search-wrapper", {"display": "block"})
5656// We ensure the search bar has the focus.
5757assert: "#mdbook-searchbar:focus"
5858
59- // We input "test ".
60- write: "test "
59+ // We input "thunder ".
60+ write: "thunder "
6161// The results should now appear.
62- wait-for-text: ("#mdbook-searchresults-header", "search results for 'test ':", ENDS_WITH )
62+ wait-for-text: ("#mdbook-searchresults-header", "1 search result for 'thunder ':")
6363assert: "#mdbook-searchresults"
6464// Ensure that the URL was updated as well.
65- assert-document-property: ({"URL": "?search=test "}, ENDS_WITH)
65+ assert-document-property: ({"URL": "?search=thunder "}, ENDS_WITH)
6666
6767// Now we ensure that when we land on the page with a "search in progress", the search results are
6868// loaded and that the search input has focus.
69- go-to: |DOC_PATH| + "test_book /index.html?search=test "
70- wait-for-text: ("#mdbook-searchresults-header", "search results for 'test ':", ENDS_WITH )
69+ go-to: |DOC_PATH| + "search /index.html?search=thunder "
70+ wait-for-text: ("#mdbook-searchresults-header", "1 search result for 'thunder ':")
7171assert: "#mdbook-searchbar:focus"
7272assert: "#mdbook-searchresults"
7373
0 commit comments