Skip to content

Instantly share code, notes, and snippets.

@laser
Last active December 26, 2015 19:39
Show Gist options
  • Save laser/7202624 to your computer and use it in GitHub Desktop.
Save laser/7202624 to your computer and use it in GitHub Desktop.
// in the test code:
it("updates the page title on click", function() {
assert.equals(view.find("h1").text(), "before update");
view.find("button").trigger("click"); // uh oh-async!
assert.equals(view.find("h1").text(), "after update"); // will fail due to callback being part of different stack
});
// in the view itself:
button.onclick = function(e) {
setTimeout(function() {
header.innerHTML = "after update";
}, 500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment