UNPKG

@salla.sa/twilight-components

Version:
44 lines (43 loc) 1.91 kB
/*! * Crafted with ❤ by Salla */ import { newE2EPage } from "@stencil/core/testing"; describe('salla-user-settings', () => { it('renders', async () => { const page = await newE2EPage(); await page.setContent('<salla-user-settings></salla-user-settings>'); const element = await page.find('salla-user-settings'); expect(element).not.toBeNull(); }); it("should click on the toggle checkbox input to toggle notifications", async () => { const page = await newE2EPage(); await page.setContent(`<salla-user-settings></salla-user-settings>`); await page.waitForChanges(); const toggleInput = await page.find(".s-toggle-input"); const oldCheckedStatus = await toggleInput.getProperty('checked'); toggleInput.click(); await page.waitForChanges(); const newCheckedStatus = await toggleInput.getProperty("checked"); expect(newCheckedStatus).not.toEqual(oldCheckedStatus); }); it("should open user deactivation modal and click on the delete button", async () => { let cb = jest.fn(); salla.profile.delete = async () => cb(); const page = await newE2EPage(); await page.setContent(`<salla-user-settings></salla-user-settings>`); await page.waitForChanges(); const deactivationAction = await page.find(".s-user-settings-section-deactivate-user .s-user-settings-section-action"); //@ts-ignore const button = deactivationAction.children[0]; button.click(); // openDeactivateModal method should be called by now await page.waitForChanges(); const confirmationAction = await page.find('.s-user-settings-confirmation-actions'); // Get and click the confirmation button //@ts-ignore const confirmationButton = confirmationAction.children[1]; await confirmationButton.click(); await page.waitForChanges(); expect(cb).toHaveBeenCalled(); }); }); //# sourceMappingURL=salla-user-settings.e2e.js.map