J'ai écrit une méthode javascript qui modifie la valeur d'une suggestion sur un clic d'une image.Jasmine testcase
function startDestinationF(a) {
var startDestination = document.getElementById('startDestination');
startDestination.selectedIndex = (a);}
Maintenant, je dois écrire un testcase jasmin pour vérifier si cette méthode fonctionne vraiment, mais je ne suis pas vraiment.
J'ai essayé:
describe("Change onclick the value of the drop down menu", function() {
var startDestination;
beforeEach(function() {
startDestination = document.getElementById('startDestination');
});
it("should change the value", function() {
expect(startDestinationF(3)).toBe(startDestination.selectedIndex==3);
});});
mais il dit: "Impossible de lire la propriété 'selectedIndex' de null". Je suis un débutant sur ce domaine et je pourrais vraiment besoin d'aide ...
grâce