I'm wondering why my tests are both passing but with failures.
The code that is used to tests features is:
var fireHotKey = function (key) {
var event = document.createEvent('HTMLEvents'),
input = document.querySelector(SELECTOR_INPUT);
event.keyCode = key;
event.initEvent('keyup', false, true);
input.dispatchEvent(event);
};
it('Should create a new tag based on user input', function (done) {
var input = document.querySelector(SELECTOR_INPUT),
tagsContainer = document.querySelector(SELECTOR_TAGS),
tagName = 'sunpietro';
input.value = tagName;
fireHotKey(KEY_COMMA);
document.addEventListener(EVENT_TAGS_CREATED, function () {
expect(tagsContainer).to.contain(SELECTOR_TAG);
expect(tagsContainer.querySelectorAll(SELECTOR_TAG)).to.have.length(1);
done();
});
});
What is done incorrectly?
Aucun commentaire:
Enregistrer un commentaire