@salla.sa/twilight-components
Version:
Salla Web Component
48 lines (47 loc) • 1.68 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { newSpecPage } from "@stencil/core/testing";
import { SallaCartSummary } from "../salla-cart-summary";
describe('salla-cart-summary', () => {
it('should build', () => {
expect(new SallaCartSummary()).toBeTruthy();
});
describe('rendering', () => {
let page;
beforeEach(async () => {
page = await newSpecPage({
components: [SallaCartSummary],
html: '<salla-cart-summary show-cart-label="false"></salla-cart-summary>'
});
});
it('should be able to render component', async () => {
await page.waitForChanges();
let component = page.doc.querySelector('salla-cart-summary');
expect(component.showCartLabel).toBeFalsy();
});
});
describe("animation", () => {
let page;
let img;
beforeEach(async () => {
page = await newSpecPage({
components: [SallaCartSummary],
html: '<salla-cart-summary show-cart-label="false"></salla-cart-summary>'
});
img = document.createElement('img');
});
it("should call method to animate product image and fail", async () => {
await page.waitForChanges();
let component = page.doc.querySelector('salla-cart-summary');
img.src = null;
await component.animateToCart(null).then((resp) => expect(resp).toBeUndefined());
});
it("should call method to animate product image", async () => {
await page.waitForChanges();
let component = page.doc.querySelector('salla-cart-summary');
await component.animateToCart(img).then(resp => console.log("RESPONSE:: ", resp));
});
});
});
//# sourceMappingURL=salla-cart-summary.spec.js.map