UNPKG

@salla.sa/twilight-components

Version:
78 lines (77 loc) 2.71 kB
/*! * Crafted with ❤ by Salla */ import { newE2EPage } from "@stencil/core/testing"; describe('salla-localization-modal-e2e', () => { let page; let element; beforeEach(async () => { page = await newE2EPage({ html: `<salla-localization-modal></salla-localization-modal>` }); element = await page.find('salla-localization-modal'); }); it('should render the component', async () => { expect(element).not.toBeNull(); }); it('should be able to call method to open the modal', async () => { await element.callMethod('open'); await page.waitForChanges(); const modal = await page.find('salla-modal'); expect(modal).not.toBeNull(); }); it('should work for languages prop', async () => { await page.$eval("salla-localization-modal", elm => { //@ts-ignore elm.languages = ["AR", "EN"]; }); await page.waitForChanges(); const input = await element.find("input"); expect(input.getAttribute('name')).toBe('language'); }); it('should work for languages prop to render select field', async () => { await page.$eval("salla-localization-modal", elm => { //@ts-ignore elm.languages = ["AR", "EN", "AB", "CD", "EF", "GH"]; }); await page.waitForChanges(); const select = await element.find("select"); expect(select.getAttribute('name')).toBe('language'); }); it('should work for currencies prop', async () => { await page.$eval("salla-localization-modal", elm => { //@ts-ignore elm.currencies = ["SAR", "USD"]; }); await page.waitForChanges(); const input = await element.find("input"); expect(input.getAttribute('name')).toBe('currency'); }); it('should work for currencies prop', async () => { await page.$eval("salla-localization-modal", elm => { //@ts-ignore elm.currencies = ["SAR", "USD", "XYZ", "ABC", "ETB", "EUR"]; }); await page.waitForChanges(); const select = await element.find("select"); expect(select.getAttribute('name')).toBe('currency'); }); it('should be able to call method to close the modal', async () => { await element.callMethod('close'); await page.waitForChanges(); const contentElement = await page.find('salla-modal'); expect(contentElement).toBeNull(); }); it('should be able to call method to submit the modal', async () => { await element.callMethod('open'); await page.waitForChanges(); await element.callMethod('submit'); await page.waitForChanges() .then(async () => { return await page.find('salla-modal'); }).then((modal) => { expect(modal).toBeNull(); }); }); }); //# sourceMappingURL=salla-localization-modal.e2e.js.map