UNPKG

@salla.sa/twilight-components

Version:
56 lines (55 loc) 1.96 kB
/*! * Crafted with ❤ by Salla */ import { newE2EPage } from "@stencil/core/testing"; describe('salla-button-e2e', () => { let page; let element; beforeEach(async () => { page = await newE2EPage({ html: ` <salla-button shape="icon" color="success" fill="outline" size="large" width="wide" loading="false" loader-position="center"></salla-button> ` }); element = await page.find('salla-button'); }); it('should render the component', async () => { expect(element).not.toBeNull(); }); it('should be able to change a prop', async () => { element.setProperty('disabled', true); await page.waitForChanges(); const disabiltiy = await element.getProperty('disabled'); expect(disabiltiy).toBe(true); }); it('should be able to call a method', async () => { await element.callMethod('setText', "Learn more"); const value = (await element.find('.s-button-text')).textContent; expect(value).toBe('Learn more'); }); it('should be able to call a method', async () => { await element.callMethod('load'); await page.waitForChanges(); const loadingFlag = await element.getProperty('loading'); expect(loadingFlag).toBe(true); }); it('should be able to call a method', async () => { await element.callMethod('stop'); await page.waitForChanges(); const loadingFlag = await element.getProperty('loading'); expect(loadingFlag).toBe(false); }); it('should be able to call a method', async () => { await element.callMethod('disable'); await page.waitForChanges(); const isDisabled = await element.getProperty('disabled'); expect(isDisabled).toBe(true); }); it('should be able to call a method', async () => { await element.callMethod('enable'); await page.waitForChanges(); const isDisabled = await element.getProperty('disabled'); expect(isDisabled).toBe(false); }); }); //# sourceMappingURL=salla-button.e2e.js.map