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