UNPKG

@salla.sa/twilight-components

Version:
64 lines (63 loc) 2.19 kB
/*! * Crafted with ❤ by Salla */ import { newSpecPage } from "@stencil/core/testing"; import { SallaInfiniteScroll } from "../salla-infinite-scroll"; describe("salla infinite scroll", () => { it("should build", () => { expect(new SallaInfiniteScroll()).toBeTruthy(); }); describe("rendering", () => { let page; beforeEach(async () => { page = await newSpecPage({ components: [SallaInfiniteScroll], html: '<salla-infinte-scroll next-page="https://localhost?page=2"></salla-infinte-scroll>' }); }); it('should be able to render component', async () => { await page.waitForChanges(); let component = page.doc.querySelector('salla-infinte-scroll'); expect(component).not.toBeNull(); }); }); describe('checking for prop values', () => { let page; let element; beforeEach(async () => { page = await newSpecPage({ components: [SallaInfiniteScroll], html: '<salla-infinite-scroll></salla-infinite-scroll>', }); element = await page.doc.querySelector('salla-infinite-scroll'); }); it('should work for next-page prop', async () => { element.nextPage = 'next page elements'; await page.waitForChanges(); expect(element.nextPage).toBe('next page elements'); }); it('should work for autoload prop', async () => { element.autoload = true; await page.waitForChanges(); expect(element.autoload).toBe(true); }); it('should work for container prop', async () => { element.container = 'scroll-container'; await page.waitForChanges(); expect(element.container).toBe('scroll-container'); }); it('should work for item prop', async () => { element.item = 'scroll-items'; await page.waitForChanges(); expect(element.item).toBe('scroll-items'); }); }); /** * @State() loadMore: string; @State() noMore: string; @State() failedToLoad: string; @JamalAlMatari please advise on this. These state attributes are not used in this component. So it's hard to write a test since their use is not clear. */ }); //# sourceMappingURL=salla-infinite-scroll.spec.js.map