I'm working with mocha unit test and I need to test if an element is visible after click on a radio button. In other words I have two radio buttons that toggle two elements using javascript and I would like to test this.
this is my test:
it("Checking #completed-task existance", function (done) {
chai.assert.equal($("#completed-task").length, 1);
done();
});
it("Checking #completed-task is visible", function (done) {
$("#master div.onoffswitch").find("input[data-id='completed-task']").click();
chai.assert.equal($("#completed-task").is(":visible"), true);
});
the first test passes but the second one doesn't. the problem is that $("#completed-task").is(":visible")
is always false, in the actual page this works just fine, any suggestions?