@griddo/ax 1.75.53 → 1.75.55

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "1.75.53",
4
+ "version": "1.75.55",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -230,5 +230,5 @@
230
230
  "publishConfig": {
231
231
  "access": "public"
232
232
  },
233
- "gitHead": "7c9febbe6666f2e32fe796809e1a322a4e753c9b"
233
+ "gitHead": "2d83527adb091a329d497b8bea8ff9294b59201f"
234
234
  }
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { BrowserRouter } from "react-router-dom";
2
3
 
3
4
  import { ThemeProvider } from "styled-components";
4
5
  import { render, cleanup, screen, fireEvent, waitFor, act } from "@testing-library/react";
@@ -55,12 +56,16 @@ describe("Browser component rendering", () => {
55
56
  expect(browserContentWrapper).not.toBeTruthy();
56
57
  });
57
58
 
58
- it("should do the copyUrl action and return console error", () => {
59
+ it("should do the copyUrl action and return console error", async () => {
59
60
  defaultProps.isPreview = true;
60
61
  defaultProps.showIframe = true;
62
+ defaultProps.content = {
63
+ id: 1,
64
+ entity: 123,
65
+ };
61
66
 
62
67
  document.execCommand = jest.fn();
63
- console.log = jest.fn();
68
+ console.error = jest.fn();
64
69
 
65
70
  render(
66
71
  <ThemeProvider theme={parseTheme(globalTheme)}>
@@ -76,10 +81,11 @@ describe("Browser component rendering", () => {
76
81
  const iconWrapperBrowser = screen.getAllByTestId("icon-wrapper-browser");
77
82
 
78
83
  fireEvent.click(iconWrapperBrowser[0]);
79
- waitFor(() => expect(console.log).toHaveBeenCalledWith("Could not copy text:"));
84
+
85
+ await waitFor(() => expect(console.error).toHaveBeenCalledWith("Could not copy text: ", undefined));
80
86
  });
81
87
 
82
- it("should do the copyUrl action and return document.execCommand call", () => {
88
+ it("should do the copyUrl action and return document.execCommand call", async () => {
83
89
  defaultProps.isPreview = true;
84
90
  defaultProps.showIframe = true;
85
91
 
@@ -90,7 +96,8 @@ describe("Browser component rendering", () => {
90
96
  render(
91
97
  <ThemeProvider theme={parseTheme(globalTheme)}>
92
98
  <Browser {...defaultProps} />
93
- </ThemeProvider>
99
+ </ThemeProvider>,
100
+ { wrapper: BrowserRouter }
94
101
  );
95
102
  const browserWrapper = screen.getByTestId("browser-wrapper");
96
103
  expect(browserWrapper).toBeTruthy();
@@ -98,12 +105,16 @@ describe("Browser component rendering", () => {
98
105
  const iconWrapperBrowser = screen.getAllByTestId("icon-wrapper-browser");
99
106
 
100
107
  fireEvent.click(iconWrapperBrowser[0]);
101
- waitFor(() => expect(screen.getByText(/URL Copied/i)).toBeInTheDocument());
108
+ await waitFor(() => expect(screen.getByText(/URL Copied/i)).toBeInTheDocument());
102
109
  });
103
110
 
104
- it("should do the copyUrl action and return clipboard call", () => {
111
+ it("should do the copyUrl action and return clipboard call", async () => {
105
112
  defaultProps.isPreview = true;
106
113
  defaultProps.showIframe = true;
114
+ defaultProps.content = {
115
+ id: 2,
116
+ entity: 456,
117
+ };
107
118
 
108
119
  Object.assign(navigator, {
109
120
  clipboard: {
@@ -128,11 +139,7 @@ describe("Browser component rendering", () => {
128
139
 
129
140
  const iconWrapperBrowser = screen.getAllByTestId("icon-wrapper-browser");
130
141
  fireEvent.click(iconWrapperBrowser[0]);
131
- waitFor(() =>
132
- expect(navigator.clipboard.writeText).toBeCalledWith(
133
- "http://localhost/page-preview/4390/c221db88-41bf-423b-8e40-d5f7837db627"
134
- )
135
- );
142
+ await waitFor(() => expect(navigator.clipboard.writeText).toBeCalledWith("http://localhost/page-preview/2/456"));
136
143
  });
137
144
 
138
145
  it("should render the browserContent", () => {
@@ -1,13 +1,12 @@
1
1
  import * as React from "react";
2
2
 
3
3
  import { ThemeProvider } from "styled-components";
4
- import { render, cleanup, screen, fireEvent, waitFor } from "@testing-library/react";
4
+ import { render, cleanup, screen, fireEvent } from "@testing-library/react";
5
5
  import { parseTheme } from "@ax/helpers";
6
6
  import "@testing-library/jest-dom";
7
7
 
8
8
  import MenuItem, { IMenuItemProps } from "@ax/components/MenuItem";
9
9
  import globalTheme from "@ax/themes/theme.json";
10
- import userEvent from "@testing-library/user-event";
11
10
 
12
11
  afterEach(cleanup);
13
12
 
@@ -513,7 +513,7 @@ describe("Sites module events", () => {
513
513
  expect(listSitesItems.length).toEqual(2);
514
514
 
515
515
  fireEvent.click(listSitesItems[0]);
516
- waitFor(() => expect(history.location.pathname).toEqual("/sites/pages"));
516
+ await waitFor(() => expect(history.location.pathname).toEqual("/sites/pages"));
517
517
  });
518
518
 
519
519
  it("should display grid view on click grid option button", async () => {