UNPKG

@salla.sa/twilight-components

Version:
65 lines (64 loc) 2.16 kB
/*! * Crafted with ❤ by Salla */ import { newSpecPage } from "@stencil/core/testing"; import { SallaLocalizationModal } from "../salla-localization-modal"; describe('salla localization modal', () => { it('should build', () => { expect(new SallaLocalizationModal()).toBeTruthy(); }); describe('checking for props', () => { let page; let element; beforeEach(async () => { page = await newSpecPage({ components: [SallaLocalizationModal], html: '<salla-localization-modal></salla-localization-modal>', }); element = await page.doc.querySelector('salla-localization-modal'); }); it('should work for language prop', async () => { element.language = 'ar'; await page.waitForChanges(); expect(element.language).toBe('ar'); }); it('should work for currency prop', async () => { element.currency = 'SAR'; await page.waitForChanges(); expect(element.currency).toBe('SAR'); }); }); describe('checking for method calls', () => { let page; //@ts-ignore let element; beforeEach(async () => { page = await newSpecPage({ components: [SallaLocalizationModal], html: '<salla-localization-modal></salla-localization-modal>', }); element = await page.doc.querySelector('salla-localization-modal'); }); it("should be able to call method to open the modal", async () => { await page.root.open(); await page.waitForChanges(); expect(page.rootInstance.modal).toBeInstanceOf(HTMLSallaModalElement); }); it("should be able to call method to close the modal", async () => { await page.root.close(); await page.waitForChanges(); expect(page.rootInstance.modal).toBeUndefined(); }); it("should be able to call method to close the modal", async () => { await page.root.open(); await page.waitForChanges(); // await page.root.submit(); await page.waitForChanges() .then(() => { expect(page.rootInstance.modal).toBeUndefined(); }); }); }); }); //# sourceMappingURL=salla-localization-modal.spec.js.map