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