@salesforcedevs/dx-components 0.26.1-alpha.13 → 0.26.1-alpha.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "0.26.1-alpha.13",
3
+ "version": "0.26.1-alpha.14",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -1,3 +0,0 @@
1
- <template>
2
- <dx-button>test</dx-button>
3
- </template>
@@ -1,3 +0,0 @@
1
- import { LightningElement } from "lwc";
2
-
3
- export default class ButtonTest extends LightningElement {}
@@ -1,4 +0,0 @@
1
- import { LightningElement } from "lwc";
2
- // Wrapper component required to test dx/featureGrid.
3
- // This component is not exposed in the build.
4
- export default class CodeBlockTest extends LightningElement {}
@@ -1,7 +0,0 @@
1
- <template>
2
- <dx-feature-grid>
3
- <dx-feature button-label="Feature 1" title="Feature 1"></dx-feature>
4
- <dx-feature button-label="Feature 2" title="Feature 2"></dx-feature>
5
- <dx-feature button-label="Feature 3" title="Feature 3"></dx-feature>
6
- </dx-feature-grid>
7
- </template>
@@ -1,5 +0,0 @@
1
- import { LightningElement } from "lwc";
2
-
3
- // Wrapper component required to test dx/featureGrid.
4
- // This component is not exposed in the build.
5
- export default class FeatureGridTest extends LightningElement {}
@@ -1,4 +0,0 @@
1
- <template>
2
- <button onclick={handleButtonClick}>Click me!</button>
3
- <dx-instrumentation use-google-tag-manager></dx-instrumentation>
4
- </template>
@@ -1,8 +0,0 @@
1
- import { LightningElement } from "lwc";
2
- import { track } from "dx/instrumentation";
3
-
4
- export default class InstrumentationTest extends LightningElement {
5
- handleButtonClick(e: MouseEvent) {
6
- track(e.currentTarget, "buttonClick", { buttonName: "default" });
7
- }
8
- }
@@ -1,6 +0,0 @@
1
- <template>
2
- <dx-popover open-on-hover={openOnHover}>
3
- <dx-button slot="control">test control</dx-button>
4
- <div slot="content">test content</div>
5
- </dx-popover>
6
- </template>
@@ -1,5 +0,0 @@
1
- import { LightningElement, api } from "lwc";
2
-
3
- export default class PopoverTest extends LightningElement {
4
- @api openOnHover: boolean = false;
5
- }
@@ -1,58 +0,0 @@
1
- const mockMediaMatch = (matches: boolean) => (query: string) => ({
2
- matches,
3
- media: query,
4
- onchange: null,
5
- addListener: jest.fn(),
6
- removeListener: jest.fn(),
7
- addEventListener: jest.fn(),
8
- removeEventListener: jest.fn(),
9
- dispatchEvent: jest.fn()
10
- });
11
-
12
- export const createMediaMock = (
13
- defaultMatch = false,
14
- matchesList: Array<boolean> = []
15
- ) => {
16
- const mediaMock = jest.fn(mockMediaMatch(defaultMatch));
17
- matchesList.forEach((value) =>
18
- mediaMock.mockImplementationOnce(mockMediaMatch(value))
19
- );
20
- return mediaMock;
21
- };
22
-
23
- export const matchMediaMock = createMediaMock();
24
-
25
- export const mockLocalStorage = function () {
26
- let store: { [key: string]: string } = {};
27
- return {
28
- getItem: function (key: string) {
29
- return store[key] || null;
30
- },
31
- setItem: function (key: string, value: string) {
32
- store[key] = value.toString();
33
- },
34
- removeItem: function (key: string) {
35
- delete store[key];
36
- },
37
- clear: function () {
38
- store = {};
39
- }
40
- };
41
- };
42
-
43
- export const mockQueryParameter = (q: string): void => {
44
- global.window = Object.create(window);
45
- const search = q ? `?q=${q}` : "";
46
- const href = `http://dummy.com${search}`;
47
- // @ts-ignore
48
- delete window.location.value;
49
- Object.defineProperty(window, "location", {
50
- value: {
51
- href,
52
- search
53
- },
54
- writable: true
55
- });
56
- };
57
-
58
- export const unmockQueryParameter = () => mockQueryParameter("");
@@ -1,32 +0,0 @@
1
- import { html } from "lit-html";
2
-
3
- export const createRenderComponents =
4
- (component: string) =>
5
- (num: number = 12, props: string = "") => {
6
- let shell = ``;
7
- for (let i = 0; i < num; i++) {
8
- const insertIndex = component.indexOf(">");
9
- const _component = [
10
- component.slice(0, insertIndex),
11
- ` ${props}`,
12
- component.slice(insertIndex)
13
- ].join("");
14
- shell = `
15
- ${shell}
16
- ${_component}
17
- `;
18
- }
19
- return shell;
20
- };
21
-
22
- export const renderStyle = (componentTag: string) => html`
23
- <style>
24
- span {
25
- color: grey;
26
- }
27
- ${componentTag} {
28
- margin-top: 16px;
29
- margin-bottom: 36px;
30
- }
31
- </style>
32
- `;
@@ -1,38 +0,0 @@
1
- import { createElement, LightningElement } from "lwc";
2
-
3
- export const renderLightningElement = (
4
- element: LightningElement,
5
- properties = {}
6
- ) => {
7
- Object.assign(element, properties);
8
- document.body.appendChild(element as unknown as Node);
9
- return element;
10
- };
11
-
12
- export const createRenderComponent =
13
- (tag: string, LWC: new () => LightningElement) =>
14
- (properties = {}) => {
15
- const component = createElement(tag, {
16
- is: LWC
17
- });
18
-
19
- renderLightningElement(component, properties);
20
- return component;
21
- };
22
-
23
- export const mockSlottedElement = <T extends HTMLElement>(
24
- element: any,
25
- elementType = "button",
26
- slotName?: string
27
- ): { slottedElement: T; slot: HTMLSlotElement } => {
28
- const slot: HTMLSlotElement = element.shadowRoot.querySelector(
29
- `slot${slotName ? `[name='${slotName}` : ""}']`
30
- );
31
- expect(slot).not.toBeNull();
32
-
33
- const slottedElement = document.createElement(elementType) as T;
34
- slot.assignedElements = jest.fn(() => [slottedElement]);
35
- slot.dispatchEvent(new Event("slotchange"));
36
-
37
- return { slottedElement, slot };
38
- };