Compare commits
3 Commits
bab99a96dd
...
8b7d9adb05
Author | SHA1 | Date | |
---|---|---|---|
8b7d9adb05 | |||
b8ed8b806e | |||
74f9208f1f |
29
package-lock.json
generated
29
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vCarousel",
|
||||
"version": "0.5.0",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -359,9 +359,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/json-schema": {
|
||||
"version": "7.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.8.tgz",
|
||||
"integrity": "sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg==",
|
||||
"version": "7.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz",
|
||||
"integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/minimatch": {
|
||||
@ -550,6 +550,12 @@
|
||||
"integrity": "sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn-import-assertions": {
|
||||
"version": "1.7.6",
|
||||
"resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.7.6.tgz",
|
||||
"integrity": "sha512-FlVvVFA1TX6l3lp8VjDnYYq7R1nyW6x3svAt4nDgrWQ9SBaSh9CnbwgSUTasgfNfOG5HlM1ehugCvM+hjo56LA==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.1.0.tgz",
|
||||
@ -6092,9 +6098,9 @@
|
||||
}
|
||||
},
|
||||
"webpack": {
|
||||
"version": "5.47.1",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.47.1.tgz",
|
||||
"integrity": "sha512-cW+Mzy9SCDapFV4OrkHuP6EFV2mAsiQd+gOa3PKtHNoKg6qPqQXZzBlHH+CnQG1osplBCqwsJZ8CfGO6XWah0g==",
|
||||
"version": "5.48.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.48.0.tgz",
|
||||
"integrity": "sha512-CGe+nfbHrYzbk7SKoYITCgN3LRAG0yVddjNUecz9uugo1QtYdiyrVD8nP1PhkNqPfdxC2hknmmKpP355Epyn6A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/eslint-scope": "^3.7.0",
|
||||
@ -6103,6 +6109,7 @@
|
||||
"@webassemblyjs/wasm-edit": "1.11.1",
|
||||
"@webassemblyjs/wasm-parser": "1.11.1",
|
||||
"acorn": "^8.4.1",
|
||||
"acorn-import-assertions": "^1.7.6",
|
||||
"browserslist": "^4.14.5",
|
||||
"chrome-trace-event": "^1.0.2",
|
||||
"enhanced-resolve": "^5.8.0",
|
||||
@ -6119,7 +6126,7 @@
|
||||
"tapable": "^2.1.1",
|
||||
"terser-webpack-plugin": "^5.1.3",
|
||||
"watchpack": "^2.2.0",
|
||||
"webpack-sources": "^3.1.1"
|
||||
"webpack-sources": "^3.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"enhanced-resolve": {
|
||||
@ -6380,9 +6387,9 @@
|
||||
}
|
||||
},
|
||||
"webpack-sources": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.1.2.tgz",
|
||||
"integrity": "sha512-//DeuK5SzM6yFRXNOGK+4tX7QB8PghkL8kFBPyqSlN62oJOUkmby8ptV7+IBGH6BkIuIw5Rjd7OvvwZaoiF4ag==",
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.0.tgz",
|
||||
"integrity": "sha512-fahN08Et7P9trej8xz/Z7eRu8ltyiygEo/hnRi9KqBUs80KeDcnf96ZJo++ewWd84fEf3xSX9bp4ZS9hbw0OBw==",
|
||||
"dev": true
|
||||
},
|
||||
"websocket-driver": {
|
||||
|
12
package.json
12
package.json
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "vCarousel",
|
||||
"version": "0.5.0",
|
||||
"version": "1.0.0",
|
||||
"description": "Video carousel, a new video appears when the previous one finishes playing.",
|
||||
"main": "index.js",
|
||||
"main": "./src/vCarousel.ts",
|
||||
"scripts": {
|
||||
"test": "karma start",
|
||||
"build": "webpack",
|
||||
@ -16,7 +16,11 @@
|
||||
"carousel",
|
||||
"video"
|
||||
],
|
||||
"author": "Fabrice PENHOËT",
|
||||
"author": {
|
||||
"name": "Fabrice PENHOËT",
|
||||
"email": "fabrice@le-fab-lab.com",
|
||||
"url": "https://www.le-fab-lab.com"
|
||||
},
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "^3.8.2",
|
||||
@ -28,7 +32,7 @@
|
||||
"karma-typescript": "^5.5.1",
|
||||
"ts-loader": "^8.3.0",
|
||||
"typescript": "^4.3.5",
|
||||
"webpack": "^5.47.1",
|
||||
"webpack": "^5.48.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-dev-server": "^3.11.2"
|
||||
},
|
||||
|
@ -49,7 +49,7 @@ export class vCarousel
|
||||
// Si this._firstVideoId a été fourni, on vérifie qu'il est présent dans la liste des conteneurs de vidéos.
|
||||
set firstVideoId(firstVideo: string|undefined)
|
||||
{
|
||||
if((firstVideo!=="" && this._vContainers.findIndex(video => video.id === firstVideo) !== -1) || (firstVideo===""))
|
||||
if((firstVideo!==undefined && firstVideo!=="" && this._vContainers.findIndex(video => video.id === firstVideo) !== -1) || ( firstVideo===""))
|
||||
this._firstVideoId=firstVideo;
|
||||
}
|
||||
|
||||
@ -109,19 +109,12 @@ export class vCarousel
|
||||
if(nbTurn < (vCarousel.nbVContainers-1) || vCarousel._noStop===true)
|
||||
{
|
||||
vContainer.style.display = "none";
|
||||
let nextVContainer: HTMLElement, nextVideo: HTMLMediaElement, nextHash: string;
|
||||
let nextVContainer: HTMLElement, nextVideo: HTMLMediaElement, nextHash: string, nextOne=0;
|
||||
if(i < (vCarousel.nbVContainers-1))
|
||||
{
|
||||
nextVContainer=vCarousel._vContainers[i+1].containerElt;
|
||||
nextVideo=vCarousel._vContainers[i+1].videoElt;
|
||||
nextHash=vCarousel._vContainers[i+1].id;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextVContainer=vCarousel._vContainers[0].containerElt;
|
||||
nextVideo=vCarousel._vContainers[0].videoElt;
|
||||
nextHash=vCarousel._vContainers[0].id;
|
||||
}
|
||||
nextOne=i+1;
|
||||
nextVContainer=vCarousel._vContainers[nextOne].containerElt;
|
||||
nextVideo=vCarousel._vContainers[nextOne].videoElt;
|
||||
nextHash=vCarousel._vContainers[nextOne].id;
|
||||
nextVContainer.style.display = "block";
|
||||
vCarousel._currentVideo=nextVideo;
|
||||
// On adapte l'ancre de l'url de manière à ce qu'elle soit cohérente avec la vidéo affichée.
|
||||
|
@ -32,19 +32,19 @@ describe("vCarousel", function()
|
||||
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 vidéo.", function()
|
||||
it("Doit générer une erreur si tous les ids passés ne correspondent pas à des éléments HTML contenant une balise <video>.", function()
|
||||
{
|
||||
expect(function() { return vCarouselTest.vContainers=["noVideo","video1","video2"]; }).toThrowError(errors.videoNotFound+"noVideo");
|
||||
expect(function() { return vCarouselTest.vContainers=["video1","noVideo","video2"]; }).toThrowError(errors.videoNotFound+"noVideo");
|
||||
expect(function() { return vCarouselTest.vContainers=["video1","video2","noVideo"]; }).toThrowError(errors.videoNotFound+"noVideo");
|
||||
});
|
||||
|
||||
it("Doit générer une erreur s'il n'y a pas au moins 2 ids valides passés pour les éléments HTML contenant les vidéos.", function()
|
||||
it("Doit générer une erreur s'il n'y a pas au moins 2 ids valides passés pour les éléments HTML contenant les balises <video>.", function()
|
||||
{
|
||||
expect(function() { return vCarouselTest.vContainers=["video1"]; }).toThrowError(errors.need2Videos);
|
||||
});
|
||||
|
||||
it("Ne doit pas générer d'erreur s'il y a au moins 2 ids passés correspondant à des éléments HTML valides et contenant chacun une vidéo.", function()
|
||||
it("Ne doit pas générer d'erreur s'il y a au moins 2 ids passés correspondant à des éléments HTML valides et contenant chacun une balise video.", function()
|
||||
{
|
||||
expect(function() { return vCarouselTest.vContainers=["video1","video2"]; }).not.toThrowError();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user