UNPKG

@salla.sa/twilight-components

Version:
40 lines (39 loc) 1.38 kB
/*! * Crafted with ❤ by Salla */ import { newSpecPage } from "@stencil/core/testing"; import { SallaCommentForm } from "../salla-comment-form"; describe('salla-comment-form', () => { it('should build', () => { expect(new SallaCommentForm()).toBeTruthy(); }); describe('rendering', () => { let page; beforeEach(async () => { page = await newSpecPage({ components: [SallaCommentForm], html: '<salla-comment-form show-avatar="true"></salla-comment-form>' }); }); it('should be able to render component', async () => { await page.waitForChanges(); let component = page.doc.querySelector('salla-comment-form'); expect(component.showCartLabel).toBeFalsy(); }); }); describe("testing actions", () => { it("should click on submit button to send comment to api and fail on form invalidity", async () => { let cb = jest.fn(); salla.event.on("CommentForm:: validation error!", () => cb()); let page = await newSpecPage({ components: [SallaCommentForm], html: '<salla-comment-form show-avatar="true"></salla-comment-form>' }); let submitButton = await page.doc.querySelector("salla-button"); submitButton.click(); await page.waitForChanges(); expect(cb).toHaveBeenCalled(); }); }); }); //# sourceMappingURL=salla-comment-form.spec.js.map