Liferay.Loader.define("@liferay/analytics-settings-web@5.0.51/js/components/connect/__tests__/Connect.spec",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/modal","@liferay!analytics-settings-web$testing-library/jest-dom/extend-expect","@liferay!analytics-settings-web$testing-library/react","@liferay!analytics-settings-web$testing-library/user-event","liferay!frontend-js-react-web$react","../../../App","../Connect"],(function(e,t,n){window;{var a=_interopRequireDefault(n("@frontend-taglib-clay$clayui/button")),o=_interopRequireDefault(n("@frontend-taglib-clay$clayui/modal"));n("@liferay!analytics-settings-web$testing-library/jest-dom/extend-expect");var c=n("@liferay!analytics-settings-web$testing-library/react"),r=_interopRequireDefault(n("@liferay!analytics-settings-web$testing-library/user-event")),l=_interopRequireDefault(n("liferay!frontend-js-react-web$react")),i=n("../../../App"),u=_interopRequireDefault(n("../Connect"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const Component=()=>l.default.createElement(l.default.Fragment,null,l.default.createElement(o.default.Header,null,Liferay.Language.get("disconnecting-data-source")),l.default.createElement(o.default.Body,null,l.default.createElement("p",null,l.default.createElement("strong",null,Liferay.Language.get("are-you-sure-you-want-to-disconnect-your-analytics-cloud-workspace-from-this-dxp-instance"))),l.default.createElement("p",{className:"text-secondary"},Liferay.Language.get("this-will-stop-any-syncing-of-analytics-or-contact-data-to-your-analytics-cloud-workspace"))),l.default.createElement(o.default.Footer,{last:l.default.createElement(a.default.Group,{spaced:!0},l.default.createElement(a.default,{displayType:"secondary"},Liferay.Language.get("cancel")),l.default.createElement(a.default,{displayType:"warning",onClick:()=>{}},Liferay.Language.get("disconnect")))}));describe("Connect",(()=>{it("renders DISCONNECTED component without crashing",(()=>{const{container:e}=(0,c.render)(l.default.createElement(u.default,{title:"testConnect"})),t=e.querySelector("div.sheet h2.sheet-title ~ div.sheet-text"),n=e.querySelector("div.form-group input.form-control"),a=e.querySelector("div.sheet-footer"),o=e.querySelector("button.btn");expect(t).toBeInTheDocument(),expect(t).toHaveTextContent("use-the-token-genereted-in-your-analytics-cloud-to-connect-this-workspace"),expect(n).toBeInTheDocument(),expect(a).toBeInTheDocument(),expect(o).toBeInTheDocument(),expect(o).toHaveTextContent("connect")})),it("renders CONNECTED component without crashing",(()=>{const{container:e}=(0,c.render)(l.default.createElement(i.AppContextData.Provider,{value:{connected:!0,liferayAnalyticsURL:"",pageView:i.EPageView.Default,token:""}},l.default.createElement(u.default,{title:"testConnect"}))),t=e.querySelector("div.sheet h2.sheet-title ~ div.sheet-text"),n=e.querySelector("div.form-group input.form-control"),a=e.querySelector("div.sheet-footer"),o=e.querySelector('button ~ button.btn[type="button"]');expect(t).toBeInTheDocument(),expect(n).toBeInTheDocument(),expect(a).toBeInTheDocument(),expect(o).toBeInTheDocument(),expect(o).toHaveTextContent("disconnect")})),it("renders modal when disconnect button is clicked",(()=>{const{container:e,getByText:t}=(0,c.render)(l.default.createElement(i.AppContextData.Provider,{value:{connected:!0,liferayAnalyticsURL:"",pageView:i.EPageView.Default,token:""}},l.default.createElement(u.default,{title:"testConnect"}))),n=e.querySelector("div.sheet h2.sheet-title ~ div.sheet-text"),a=e.querySelector("div.form-group input.form-control"),o=e.querySelector("div.sheet-footer"),s=e.getElementsByClassName("modal-content");expect(n).toBeInTheDocument(),expect(a).toBeInTheDocument(),expect(o).toBeInTheDocument();const d=t("disconnect");r.default.click(d),expect(s).toBeTruthy(),(0,c.render)(l.default.createElement(Component,null)),expect(c.screen.getByText(/disconnecting-data-source/i)).toBeInTheDocument(),expect(c.screen.getByText("are-you-sure-you-want-to-disconnect-your-analytics-cloud-workspace-from-this-dxp-instance")).toBeInTheDocument(),expect(c.screen.getByText("this-will-stop-any-syncing-of-analytics-or-contact-data-to-your-analytics-cloud-workspace")).toBeInTheDocument(),expect(c.screen.getByRole("button",{name:/cancel/i})).toBeInTheDocument(),expect(c.screen.getAllByText("disconnect")[1]).toBeInTheDocument()}))}))}}));
//# sourceMappingURL=Connect.spec.js.map