@salla.sa/twilight-components
Version:
Salla Web Component
77 lines (76 loc) • 2.76 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { newSpecPage } from "@stencil/core/testing";
import { SallaScopees } from "../salla-scopes";
import { ModeType } from "../interfaces";
describe("salla branches", () => {
it("should build", () => {
expect(new SallaScopees()).toBeTruthy();
});
describe("checking for prop values", () => {
let page;
let element;
it("should work with default prop values", async () => {
page = await newSpecPage({
components: [SallaScopees],
html: '<salla-scopes></salla-scopes>'
});
element = await page.doc.querySelector('salla-scopes');
await element.open(ModeType.DEFAULT, 123);
await page.waitForChanges();
// element.position = 'bottom';
// await page.waitForChanges();
// expect(element.position).toBe('bottom');
});
// it("should work for display-as prop", async () => {
// element.displayAs = 'inline';
// await page.waitForChanges();
// expect(element.displayAs).toBe('inline');
// });
//
// it("should work for browse-products-from prop", async () => {
// element.browseProductsFrom = 'store';
// await page.waitForChanges();
// expect(element.browseProductsFrom).toBe('store');
// });
//
// it("should work for branches prop", async () => {
// element.branches = [{ id: 1, open: true, available: true, limited: false }];
// await page.waitForChanges();
// expect(element.branches).toEqual([{ id: 1, open: true, available: true, limited: false }]);
// });
//
// it("should work for current prop", async () => {
// element.current = 23;
// await page.waitForChanges();
// expect(element.current).toBe(23);
// });
});
// describe('checking for method calls', () => {
// let page;
// let element;
// beforeEach(async () => {
// page = await newSpecPage({
// components: [SallaScopees],
// html: '<salla-scopes></salla-scopes>'
// });
// element = await page.root
// });
// it("should be able to call method to open the modal", async () => {
// await page.doc.show();
// await page.waitForChanges();
// const visibilityStyle = element.getAttribute('visible', null)
// expect(visibilityStyle).not.toBeNull();
// expect(page.rootInstance.modal).toBeInstanceOf(HTMLSallaModalElement);
// });
//
// it("should be able to call method to close the modal", async () => {
// await page.doc.hide();
// await page.waitForChanges();
// expect(page.rootInstance.modal).toBeUndefined();
// });
// });
// TODO: find a better way to test component states
});
//# sourceMappingURL=salla-scopes.spec.js.map