import { vCarousel } from "../src/vCarousel"; const errors=require("../src/errors.js"); describe("vCarousel", function() { let vCarouselTest : vCarousel; const videosWebDir="https://forge.chapril.org/Fab_Blab/vCarousel/src/branch/master/public/videos"; const fixture="
"; beforeEach(function() { vCarouselTest=new vCarousel(); document.body.insertAdjacentHTML('afterbegin', fixture); }); afterEach(function() { document.body.removeChild(document.getElementById('fixture')); }); it("Should be an instance of vCarousel", function() { expect(vCarouselTest).toBeInstanceOf(vCarousel); }); describe("Setting vCarousel", function() { it("Doit générer une erreur si tous les ids passés ne correspondent pas à des éléments HTML existants.", function() { expect(function() { return vCarouselTest.vContainers=["dontExistId","video1","video2"]; }).toThrowError(errors.elementNotFound+"dontExistId"); expect(function() { return vCarouselTest.vContainers=["video1","dontExistId","video2"]; }).toThrowError(errors.elementNotFound+"dontExistId"); expect(function() { return vCarouselTest.vContainers=["video1","video2","dontExistId"]; }).toThrowError(errors.elementNotFound+"dontExistId"); }); it("Doit générer une erreur si tous les ids passés ne correspondent pas à des éléments HTML contenant une balise