@salla.sa/twilight-components
Version:
Salla Web Component
38 lines (37 loc) • 1.25 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { newE2EPage } from "@stencil/core/testing";
describe('salla-tel-input-e2e', () => {
let page;
let element;
beforeEach(async () => {
page = await newE2EPage({
html: `<salla-tel-input></salla-tel-input>`
});
element = await page.find('salla-tel-input');
});
it('should render the component', async () => {
expect(element).not.toBeNull();
});
it('should be able to call method to retrieve value', async () => {
const telInput = await page.find("salla-tel-input >>> .tel-input");
await telInput.press("+1234567890");
element.setProperty('name', "phone_input_one");
element.setProperty('country-code', "SA");
await page.waitForChanges();
let value = await element.callMethod('getValues');
expect(value).toEqual({
["phone_input_one"]: "+1234567890",
countryCode: "SA"
});
});
it('should be able to call method to validate inputs', async () => {
const telInput = await page.find("salla-tel-input >>> .tel-input");
await telInput.press("+1234");
await page.waitForChanges();
let value = await element.callMethod('isValid');
expect(value).toEqual(false);
});
});
//# sourceMappingURL=salla-tel-input.e2e.js.map