Last active
April 30, 2020 23:15
-
-
Save amitgupta15/0a6f0f76ee6742c339050430ab052d32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should add a todo item to the list', function () { | |
var selector = document.querySelector('#selector'); | |
selector.innerHTML = '<form id="aform"><input type="text" name="todo-input"><button>Submit</button></form><ul id="todo-list"></ul>'; | |
var form = document.querySelector('#aform'); | |
form.elements['todo-input'].value = 'task 1'; | |
var ev = document.createEvent('HTMLEvents'); | |
ev.initEvent('submit', true, true); | |
form.dispatchEvent(ev); | |
assert(selector.innerHTML.toLowerCase().includes('<li>task 1</li>')); | |
//cleanup | |
selector.innerHTML = ''; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment