Below is my code
I want to do Jasmine test on it and I was wondering if I use beforEach and afterEach or may be spyOn() on it? I get test to pass if expect(function).toEqual(false) , but whenever i use true it throws an error.
function getMealTypeChoice(selection) {
if (!selection) {
return false;
}
var foodChoices = document.radioForm.foodChoice;
for (var i = 0; i < foodChoices.length; i++) {
foodChoices[i].addEventListener('change', function () {
selectedOptionMsg.innerHTML = "Enjoy your " + this.value.charAt(0).toUpperCase() + this.value.slice(1) + " " + selection + "!!";
mealContainer.style.display = "block";
console.log(this.value)
displaySelectedMeal(selection, this.value)
scrollTop(1400);
});
}
}
If you're running it in browser you can add the selectedOptionMsg element and your buttons to your SpecRunner.html file and compare their values to expected?