Liferay.Loader.define("@liferay/analytics-settings-web@5.0.51/js/components/attributes/__tests__/Modal.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!frontend-js-react-web$react","../../table/Table"],(function(e,t,a){window;{var n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/modal"));a("@liferay!analytics-settings-web$testing-library/jest-dom/extend-expect");var l=a("@liferay!analytics-settings-web$testing-library/react"),c=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),o=_interopRequireDefault(a("../../table/Table"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const e={actions:{},facets:[],items:[]},t={actions:{},facets:[],items:[{example:"True",name:"agreedToTermsOfUse",required:!1,selected:!0,source:"user",type:"Boolean"},{example:"31st Oct 2008",name:"birthday",required:!1,selected:!0,source:"contact",type:"Date"}]};var i;!function(e){e.Name="name",e.Type="type",e.Example="example",e.Source="source"}(i||(i={}));const u=[{expanded:!0,id:i.Name,label:Liferay.Language.get("attribute")},{id:i.Type,label:Liferay.Language.get("data-type")},{id:i.Example,label:Liferay.Language.get("sample-data"),sortable:!1},{id:i.Source,label:Liferay.Language.get("source"),sortable:!1}],Component=({onCancel:e,onSubmit:t,requestFn:a,title:l})=>{const[s,d]=(0,c.useState)({});return c.default.createElement(c.default.Fragment,null,c.default.createElement(r.default.Header,null,l),c.default.createElement(r.default.Body,null,c.default.createElement(o.default,{columns:u,emptyState:{noResultsTitle:Liferay.Language.get("no-attributes-were-found"),title:Liferay.Language.get("there-are-no-attributes")},mapperItems:e=>e.map((({example:e,name:t,required:a,selected:n,source:r,type:l})=>({checked:n,columns:[{id:i.Name,value:t},{id:i.Type,value:l},{id:i.Example,value:e},{id:i.Source,value:r}],disabled:a,id:t+r}))),onItemsChange:d,requestFn:a})),c.default.createElement(r.default.Footer,{last:c.default.createElement(n.default.Group,{spaced:!0},c.default.createElement(n.default,{displayType:"secondary",onClick:e},Liferay.Language.get("cancel")),c.default.createElement(n.default,{onClick:()=>t(s)},Liferay.Language.get("sync")))}))};describe("Modal",(()=>{it("renders Modal component without crashing",(async()=>{await(0,l.act)((async()=>{(0,l.render)(c.default.createElement(Component,{onCancel:()=>{},onSubmit:()=>{},requestFn:async()=>t,title:"Test Modal"}))})),expect(l.screen.getByText(/Test Modal/i)).toBeInTheDocument(),expect(l.screen.getByText(/Test Modal/i)).toHaveClass("modal-title"),expect(l.screen.getByText("agreedToTermsOfUse")).toBeInTheDocument(),expect(l.screen.getByText("Boolean")).toBeInTheDocument(),expect(l.screen.getByText("True")).toBeInTheDocument(),expect(l.screen.getByText("user")).toBeInTheDocument(),expect(l.screen.getByText("birthday")).toBeInTheDocument(),expect(l.screen.getByText("Date")).toBeInTheDocument(),expect(l.screen.getByText("31st Oct 2008")).toBeInTheDocument(),expect(l.screen.getByText("contact")).toBeInTheDocument()})),it("renders Modal component without crashing with empty state",(async()=>{await(0,l.act)((async()=>{(0,l.render)(c.default.createElement(Component,{onCancel:()=>{},onSubmit:()=>{},requestFn:async()=>e,title:"Test Modal"}))})),expect(l.screen.getByText(/Test Modal/i)).toBeInTheDocument(),expect(l.screen.getByText(/Test Modal/i)).toHaveClass("modal-title"),expect(document.querySelector(".c-empty-state-title")).toBeInTheDocument(),expect(l.screen.getByText("there-are-no-attributes")).toBeInTheDocument()}))}))}}));
//# sourceMappingURL=Modal.spec.js.map