@salla.sa/twilight-components
Version:
Salla Web Component
54 lines (53 loc) • 1.64 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { newSpecPage } from "@stencil/core/testing";
import { SallaRatingModal } from "../salla-rating-modal";
describe("salla rating modal", () => {
it('should build', () => {
expect(new SallaRatingModal()).toBeTruthy();
});
describe('checking for props', () => {
let page;
let element;
beforeEach(async () => {
page = await newSpecPage({
components: [SallaRatingModal],
html: '<salla-rating-modal></salla-rating-modal>'
});
element = await page.doc.querySelector('salla-rating-modal');
});
it('should work for orderId prop', async () => {
element.orderId = 4;
await page.waitForChanges();
expect(element.orderId).toBe(4);
});
});
describe('checking for methods', () => {
let page;
let element;
beforeEach(async () => {
page = await newSpecPage({
components: [SallaRatingModal],
html: '<salla-rating-modal></salla-rating-modal>'
});
// element = await page.doc.querySelector('salla-rating-modal');
element = await page.doc.querySelector('salla-rating-modal');
});
it("should open modal", async () => {
element.open();
await page.waitForChanges();
element.getAttribute('visible', null).then(value => {
expect(value).not.toBeNull();
});
});
it("should close modal", async () => {
element.close();
await page.waitForChanges();
element.getAttribute('visible', null).then(value => {
expect(value).toBeNull();
});
});
});
});
//# sourceMappingURL=salla-rating-modal.spec.js.map