@salesforcedevs/dx-components 0.10.1-alpha.96 → 0.10.1-alpha.97

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.
@@ -0,0 +1,44 @@
1
+ import SidebarSearch from "dx/sidebarSearch";
2
+ import { createRenderComponent } from "utils/tests";
3
+ import { coveoXMLDocsConfig } from "utils/coveo"; //coveoSFDocsConfig
4
+
5
+ const TAG = "dx-sidebar-search";
6
+ const render = createRenderComponent(TAG, SidebarSearch);
7
+
8
+ const PROPS = coveoXMLDocsConfig;
9
+ const QUERY = "test";
10
+
11
+ const mockQuery = (q: string): void => {
12
+ global.window = Object.create(window);
13
+ const url = `http://dummy.com?q="${q}"`;
14
+ Object.defineProperty(window, "location", {
15
+ value: {
16
+ href: url,
17
+ search: `?q=${q}`
18
+ }
19
+ });
20
+ };
21
+
22
+ describe(TAG, () => {
23
+ it("renders with the correct initial empty query", () => {
24
+ const element = render(PROPS);
25
+
26
+ const input = element.shadowRoot.querySelector("dx-input");
27
+
28
+ expect(input.value).toEqual("");
29
+
30
+ return expect(element).toBeAccessible();
31
+ });
32
+
33
+ it("renders with the correct initial query", () => {
34
+ mockQuery(QUERY);
35
+
36
+ const element = render(PROPS);
37
+
38
+ const input = element.shadowRoot.querySelector("dx-input");
39
+
40
+ expect(input.value).toEqual(QUERY);
41
+
42
+ return expect(element).toBeAccessible();
43
+ });
44
+ });