Liferay.Loader.define("@liferay/analytics-settings-web@5.0.51/js/components/people/__tests__/Modal.spec",["module","exports","require","liferay!analytics-settings-web$jest-fetch-mock","@liferay!analytics-settings-web$testing-library/jest-dom/extend-expect","@frontend-taglib-clay$clayui/modal","@liferay!analytics-settings-web$testing-library/react","liferay!frontend-js-react-web$react","liferay!frontend-js-react-web$react-dom","../Modal","../People"],(function(e,t,a){window;{var n=_interopRequireDefault(a("liferay!analytics-settings-web$jest-fetch-mock"));a("@liferay!analytics-settings-web$testing-library/jest-dom/extend-expect");var s=a("@frontend-taglib-clay$clayui/modal"),l=a("@liferay!analytics-settings-web$testing-library/react"),r=_interopRequireDefault(a("liferay!frontend-js-react-web$react")),o=_interopRequireDefault(a("liferay!frontend-js-react-web$react-dom")),c=_interopRequireDefault(a("../Modal")),i=a("../People");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const e={actions:{},facets:[],items:[{id:44275,name:"test",selected:!1},{id:44279,name:"test2",selected:!1}],lastPage:1,page:1,pageSize:20,totalCount:7},t={actions:{},facets:[],items:[],lastPage:1,page:1,pageSize:20,totalCount:0},ComponentWithData=()=>{const{observer:t}=(0,s.useModal)({onClose:()=>{}});return r.default.createElement(c.default,{columns:[{expanded:!0,id:"name",label:Liferay.Language.get("user-groups")}],emptyState:{contentRenderer:()=>r.default.createElement(r.default.Fragment,null),description:"Empty State Description",noResultsTitle:"Empty State No Results Title",title:"Empty State Title"},name:i.EPeople.UserGroupIds,observer:t,onCloseModal:()=>{},requestFn:async()=>e,syncAllAccounts:!0,syncAllContacts:!0,syncedIds:{syncedAccountGroupIds:["aaa"],syncedOrganizationIds:["bbb"],syncedUserGroupIds:["ccc"]},title:"Assign Modal Title"})},ComponentWithEmptyState=()=>{const{observer:e}=(0,s.useModal)({onClose:()=>{}});return r.default.createElement(c.default,{columns:[],emptyState:{contentRenderer:()=>r.default.createElement(r.default.Fragment,null),description:"Empty State Description",noResultsTitle:"Empty State No Results Title",title:"Empty State Title"},name:i.EPeople.UserGroupIds,observer:e,onCloseModal:()=>{},requestFn:async()=>t,syncAllAccounts:!0,syncAllContacts:!0,syncedIds:{syncedAccountGroupIds:["aaa"],syncedOrganizationIds:["bbb"],syncedUserGroupIds:["ccc"]},title:"Assign Modal Title"})};describe("People Modal",(()=>{beforeAll((()=>{o.default.createPortal=jest.fn((e=>e)),jest.useFakeTimers()})),afterAll((()=>{jest.useRealTimers()})),afterEach((()=>{jest.clearAllTimers(),jest.restoreAllMocks(),(0,l.cleanup)()})),it("renders component with data without crashing it",(async()=>{n.default.mockResponse(JSON.stringify(e)),await(0,l.act)((async()=>{(0,l.render)(r.default.createElement(ComponentWithData,null)),jest.runAllTimers(),await(0,l.waitFor)((()=>l.screen.getByText("test"))),await(0,l.waitFor)((()=>l.screen.getByText("test2")))}));const t=document.querySelector(".modal-content"),a=l.screen.getByText("test"),s=l.screen.getByText("test2");expect(t).toBeInTheDocument(),expect(a).toBeInTheDocument(),expect(s).toBeInTheDocument()})),it("renders component with Empty State without crashing it",(async()=>{n.default.mockResponse(JSON.stringify(t)),await(0,l.act)((async()=>{(0,l.render)(r.default.createElement(ComponentWithEmptyState,null)),jest.runAllTimers()}));const e=l.screen.getByText("Assign Modal Title"),a=l.screen.getByText("Empty State Title"),s=l.screen.getByText("Empty State Description");expect(e).toBeInTheDocument(),expect(a).toBeInTheDocument(),expect(s).toBeInTheDocument()}))}))}}));
//# sourceMappingURL=Modal.spec.js.map