@docsearch/react 3.0.0-alpha.42 → 3.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/AlgoliaLogo.js +1 -1
- package/dist/esm/DocSearch.d.ts +3 -0
- package/dist/esm/DocSearch.js +1 -1
- package/dist/esm/DocSearchModal.d.ts +1 -1
- package/dist/esm/DocSearchModal.js +6 -4
- package/dist/esm/NoResultsScreen.d.ts +2 -2
- package/dist/esm/NoResultsScreen.js +11 -9
- package/dist/esm/Results.js +1 -1
- package/dist/esm/ScreenState.d.ts +1 -0
- package/dist/esm/Snippet.js +2 -2
- package/dist/esm/__tests__/api.test.js +135 -23
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/index.js.map +1 -1
- package/package.json +4 -4
package/dist/esm/AlgoliaLogo.js
CHANGED
|
@@ -5,7 +5,7 @@ export function AlgoliaLogo(_ref) {
|
|
|
5
5
|
var _translations$searchB = translations.searchByText,
|
|
6
6
|
searchByText = _translations$searchB === void 0 ? 'Search by' : _translations$searchB;
|
|
7
7
|
return /*#__PURE__*/React.createElement("a", {
|
|
8
|
-
href: "https://www.algolia.com/docsearch",
|
|
8
|
+
href: "https://www.algolia.com/ref/docsearch/?utm_source=".concat(window.location.hostname, "&utm_medium=referral&utm_content=powered_by&utm_campaign=docsearch"),
|
|
9
9
|
target: "_blank",
|
|
10
10
|
rel: "noopener noreferrer"
|
|
11
11
|
}, /*#__PURE__*/React.createElement("span", {
|
package/dist/esm/DocSearch.d.ts
CHANGED
|
@@ -27,5 +27,8 @@ export interface DocSearchProps {
|
|
|
27
27
|
initialQuery?: string;
|
|
28
28
|
navigator?: AutocompleteOptions<InternalDocSearchHit>['navigator'];
|
|
29
29
|
translations?: DocSearchTranslations;
|
|
30
|
+
getMissingResultsUrl?: ({ query: string }: {
|
|
31
|
+
query: any;
|
|
32
|
+
}) => string;
|
|
30
33
|
}
|
|
31
34
|
export declare function DocSearch(props: DocSearchProps): JSX.Element;
|
package/dist/esm/DocSearch.js
CHANGED
|
@@ -8,7 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
|
|
9
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
10
|
|
|
11
|
-
function _iterableToArrayLimit(arr, i) {
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
12
|
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
|
|
@@ -12,4 +12,4 @@ export declare type DocSearchModalProps = DocSearchProps & {
|
|
|
12
12
|
onClose?: () => void;
|
|
13
13
|
translations?: ModalTranslations;
|
|
14
14
|
};
|
|
15
|
-
export declare function DocSearchModal({ appId, apiKey, indexName, placeholder, searchParameters, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, }: DocSearchModalProps): JSX.Element;
|
|
15
|
+
export declare function DocSearchModal({ appId, apiKey, indexName, placeholder, searchParameters, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, }: DocSearchModalProps): JSX.Element;
|
|
@@ -2,9 +2,9 @@ var _excluded = ["footer", "searchBox"];
|
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
6
|
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
8
|
|
|
9
9
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
16
16
|
|
|
17
17
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
18
18
|
|
|
19
|
-
function _iterableToArrayLimit(arr, i) {
|
|
19
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
20
20
|
|
|
21
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
22
|
|
|
@@ -64,7 +64,8 @@ export function DocSearchModal(_ref) {
|
|
|
64
64
|
_ref$initialQuery = _ref.initialQuery,
|
|
65
65
|
initialQueryFromProp = _ref$initialQuery === void 0 ? '' : _ref$initialQuery,
|
|
66
66
|
_ref$translations = _ref.translations,
|
|
67
|
-
translations = _ref$translations === void 0 ? {} : _ref$translations
|
|
67
|
+
translations = _ref$translations === void 0 ? {} : _ref$translations,
|
|
68
|
+
getMissingResultsUrl = _ref.getMissingResultsUrl;
|
|
68
69
|
|
|
69
70
|
var footerTranslations = translations.footer,
|
|
70
71
|
searchBoxTranslations = translations.searchBox,
|
|
@@ -362,6 +363,7 @@ export function DocSearchModal(_ref) {
|
|
|
362
363
|
favoriteSearches: favoriteSearches,
|
|
363
364
|
inputRef: inputRef,
|
|
364
365
|
translations: screenStateTranslations,
|
|
366
|
+
getMissingResultsUrl: getMissingResultsUrl,
|
|
365
367
|
onItemClick: function onItemClick(item) {
|
|
366
368
|
saveRecentSearch(item);
|
|
367
369
|
onClose();
|
|
@@ -4,8 +4,8 @@ import type { InternalDocSearchHit } from './types';
|
|
|
4
4
|
export declare type NoResultsScreenTranslations = Partial<{
|
|
5
5
|
noResultsText: string;
|
|
6
6
|
suggestedQueryText: string;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
reportMissingResultsText: string;
|
|
8
|
+
reportMissingResultsLinkText: string;
|
|
9
9
|
}>;
|
|
10
10
|
declare type NoResultsScreenProps = Omit<ScreenStateProps<InternalDocSearchHit>, 'translations'> & {
|
|
11
11
|
translations?: NoResultsScreenTranslations;
|
|
@@ -6,7 +6,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
6
6
|
|
|
7
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
8
|
|
|
9
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
10
|
|
|
11
11
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
12
|
|
|
@@ -27,10 +27,10 @@ export function NoResultsScreen(_ref) {
|
|
|
27
27
|
noResultsText = _translations$noResul === void 0 ? 'No results for' : _translations$noResul,
|
|
28
28
|
_translations$suggest = translations.suggestedQueryText,
|
|
29
29
|
suggestedQueryText = _translations$suggest === void 0 ? 'Try searching for' : _translations$suggest,
|
|
30
|
-
_translations$
|
|
31
|
-
|
|
32
|
-
_translations$
|
|
33
|
-
|
|
30
|
+
_translations$reportM = translations.reportMissingResultsText,
|
|
31
|
+
reportMissingResultsText = _translations$reportM === void 0 ? 'Believe this query should return results?' : _translations$reportM,
|
|
32
|
+
_translations$reportM2 = translations.reportMissingResultsLinkText,
|
|
33
|
+
reportMissingResultsLinkText = _translations$reportM2 === void 0 ? 'Let us know.' : _translations$reportM2;
|
|
34
34
|
var searchSuggestions = props.state.context.searchSuggestions;
|
|
35
35
|
return /*#__PURE__*/React.createElement("div", {
|
|
36
36
|
className: "DocSearch-NoResults"
|
|
@@ -55,11 +55,13 @@ export function NoResultsScreen(_ref) {
|
|
|
55
55
|
props.inputRef.current.focus();
|
|
56
56
|
}
|
|
57
57
|
}, search))]);
|
|
58
|
-
}, []))), /*#__PURE__*/React.createElement("p", {
|
|
58
|
+
}, []))), props.getMissingResultsUrl && /*#__PURE__*/React.createElement("p", {
|
|
59
59
|
className: "DocSearch-Help"
|
|
60
|
-
}, "".concat(
|
|
61
|
-
href:
|
|
60
|
+
}, "".concat(reportMissingResultsText, " "), /*#__PURE__*/React.createElement("a", {
|
|
61
|
+
href: props.getMissingResultsUrl({
|
|
62
|
+
query: props.state.query
|
|
63
|
+
}),
|
|
62
64
|
target: "_blank",
|
|
63
65
|
rel: "noopener noreferrer"
|
|
64
|
-
},
|
|
66
|
+
}, reportMissingResultsLinkText)));
|
|
65
67
|
}
|
package/dist/esm/Results.js
CHANGED
|
@@ -6,7 +6,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
6
6
|
|
|
7
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
8
|
|
|
9
|
-
function _iterableToArrayLimit(arr, i) {
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
@@ -22,5 +22,6 @@ export interface ScreenStateProps<TItem extends BaseItem> extends AutocompleteAp
|
|
|
22
22
|
disableUserPersonalization: boolean;
|
|
23
23
|
resultsFooterComponent: DocSearchProps['resultsFooterComponent'];
|
|
24
24
|
translations: ScreenStateTranslations;
|
|
25
|
+
getMissingResultsUrl?: DocSearchProps['getMissingResultsUrl'];
|
|
25
26
|
}
|
|
26
27
|
export declare const ScreenState: React.MemoExoticComponent<({ translations, ...props }: ScreenStateProps<InternalDocSearchHit>) => JSX.Element>;
|
package/dist/esm/Snippet.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _excluded = ["hit", "attribute", "tagName"];
|
|
2
2
|
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
7
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
@@ -20,6 +20,25 @@ function DocSearch(props) {
|
|
|
20
20
|
apiKey: "foo",
|
|
21
21
|
indexName: "bar"
|
|
22
22
|
}, props));
|
|
23
|
+
} // mock empty response
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function noResultSearch(_queries, _requestOptions) {
|
|
27
|
+
return new Promise(function (resolve) {
|
|
28
|
+
resolve({
|
|
29
|
+
results: [{
|
|
30
|
+
hits: [],
|
|
31
|
+
hitsPerPage: 0,
|
|
32
|
+
nbHits: 0,
|
|
33
|
+
nbPages: 0,
|
|
34
|
+
page: 0,
|
|
35
|
+
processingTimeMS: 0,
|
|
36
|
+
exhaustiveNbHits: true,
|
|
37
|
+
params: '',
|
|
38
|
+
query: ''
|
|
39
|
+
}]
|
|
40
|
+
});
|
|
41
|
+
});
|
|
23
42
|
}
|
|
24
43
|
|
|
25
44
|
describe('api', function () {
|
|
@@ -77,37 +96,23 @@ describe('api', function () {
|
|
|
77
96
|
while (1) {
|
|
78
97
|
switch (_context3.prev = _context3.next) {
|
|
79
98
|
case 0:
|
|
80
|
-
render( /*#__PURE__*/React.createElement(DocSearch
|
|
81
|
-
, {
|
|
99
|
+
render( /*#__PURE__*/React.createElement(DocSearch, {
|
|
82
100
|
transformSearchClient: function transformSearchClient(searchClient) {
|
|
83
101
|
return _objectSpread(_objectSpread({}, searchClient), {}, {
|
|
84
|
-
search:
|
|
85
|
-
return new Promise(function (resolve) {
|
|
86
|
-
resolve({
|
|
87
|
-
results: [{
|
|
88
|
-
hits: [],
|
|
89
|
-
hitsPerPage: 0,
|
|
90
|
-
nbHits: 0,
|
|
91
|
-
nbPages: 0,
|
|
92
|
-
page: 0,
|
|
93
|
-
processingTimeMS: 0,
|
|
94
|
-
exhaustiveNbHits: true,
|
|
95
|
-
params: '',
|
|
96
|
-
query: ''
|
|
97
|
-
}]
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
}
|
|
102
|
+
search: noResultSearch
|
|
101
103
|
});
|
|
102
104
|
},
|
|
103
105
|
translations: {
|
|
104
106
|
modal: {
|
|
105
107
|
noResultsScreen: {
|
|
106
108
|
noResultsText: 'Pas de résultats pour',
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
reportMissingResultsText: 'Ouvrez une issue sur docsearch-configs',
|
|
110
|
+
reportMissingResultsLinkText: 'Lien du repo'
|
|
109
111
|
}
|
|
110
112
|
}
|
|
113
|
+
},
|
|
114
|
+
getMissingResultsUrl: function getMissingResultsUrl() {
|
|
115
|
+
return 'algolia.com';
|
|
111
116
|
}
|
|
112
117
|
}));
|
|
113
118
|
_context3.next = 3;
|
|
@@ -221,4 +226,111 @@ describe('api', function () {
|
|
|
221
226
|
}, _callee5);
|
|
222
227
|
})));
|
|
223
228
|
});
|
|
229
|
+
describe('getMissingResultsUrl', function () {
|
|
230
|
+
it('does not render the link to the repository by default', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
|
|
231
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
232
|
+
while (1) {
|
|
233
|
+
switch (_context7.prev = _context7.next) {
|
|
234
|
+
case 0:
|
|
235
|
+
render( /*#__PURE__*/React.createElement(DocSearch, {
|
|
236
|
+
transformSearchClient: function transformSearchClient(searchClient) {
|
|
237
|
+
return _objectSpread(_objectSpread({}, searchClient), {}, {
|
|
238
|
+
search: noResultSearch
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}));
|
|
242
|
+
_context7.next = 3;
|
|
243
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
|
|
244
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
245
|
+
while (1) {
|
|
246
|
+
switch (_context6.prev = _context6.next) {
|
|
247
|
+
case 0:
|
|
248
|
+
_context6.next = 2;
|
|
249
|
+
return waitFor(function () {
|
|
250
|
+
fireEvent.click(document.querySelector('.DocSearch-Button'));
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
case 2:
|
|
254
|
+
fireEvent.input(document.querySelector('.DocSearch-Input'), {
|
|
255
|
+
target: {
|
|
256
|
+
value: 'q'
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
case 3:
|
|
261
|
+
case "end":
|
|
262
|
+
return _context6.stop();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}, _callee6);
|
|
266
|
+
})));
|
|
267
|
+
|
|
268
|
+
case 3:
|
|
269
|
+
expect(screen.getByText(/No results for/)).toBeInTheDocument();
|
|
270
|
+
expect(document.querySelector('.DocSearch-Help a')).not.toBeInTheDocument();
|
|
271
|
+
|
|
272
|
+
case 5:
|
|
273
|
+
case "end":
|
|
274
|
+
return _context7.stop();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}, _callee7);
|
|
278
|
+
})));
|
|
279
|
+
it('render the link to the repository', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
|
|
280
|
+
var link;
|
|
281
|
+
return regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
282
|
+
while (1) {
|
|
283
|
+
switch (_context9.prev = _context9.next) {
|
|
284
|
+
case 0:
|
|
285
|
+
render( /*#__PURE__*/React.createElement(DocSearch, {
|
|
286
|
+
transformSearchClient: function transformSearchClient(searchClient) {
|
|
287
|
+
return _objectSpread(_objectSpread({}, searchClient), {}, {
|
|
288
|
+
search: noResultSearch
|
|
289
|
+
});
|
|
290
|
+
},
|
|
291
|
+
getMissingResultsUrl: function getMissingResultsUrl(_ref9) {
|
|
292
|
+
var query = _ref9.query;
|
|
293
|
+
return "https://github.com/algolia/docsearch/issues/new?title=".concat(query);
|
|
294
|
+
}
|
|
295
|
+
}));
|
|
296
|
+
_context9.next = 3;
|
|
297
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
|
|
298
|
+
return regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
299
|
+
while (1) {
|
|
300
|
+
switch (_context8.prev = _context8.next) {
|
|
301
|
+
case 0:
|
|
302
|
+
_context8.next = 2;
|
|
303
|
+
return waitFor(function () {
|
|
304
|
+
fireEvent.click(document.querySelector('.DocSearch-Button'));
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
case 2:
|
|
308
|
+
fireEvent.input(document.querySelector('.DocSearch-Input'), {
|
|
309
|
+
target: {
|
|
310
|
+
value: 'q'
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
case 3:
|
|
315
|
+
case "end":
|
|
316
|
+
return _context8.stop();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}, _callee8);
|
|
320
|
+
})));
|
|
321
|
+
|
|
322
|
+
case 3:
|
|
323
|
+
expect(screen.getByText(/No results for/)).toBeInTheDocument();
|
|
324
|
+
link = document.querySelector('.DocSearch-Help a');
|
|
325
|
+
expect(link).toBeInTheDocument();
|
|
326
|
+
expect(link.getAttribute('href')).toBe('https://github.com/algolia/docsearch/issues/new?title=q');
|
|
327
|
+
|
|
328
|
+
case 7:
|
|
329
|
+
case "end":
|
|
330
|
+
return _context9.stop();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}, _callee9);
|
|
334
|
+
})));
|
|
335
|
+
});
|
|
224
336
|
});
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.0.0-alpha.
|
|
1
|
+
export declare const version = "3.0.0-alpha.50";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '3.0.0-alpha.
|
|
1
|
+
export var version = '3.0.0-alpha.50';
|