Skip to content

Instantly share code, notes, and snippets.

@manko
Created December 8, 2011 19:21
Show Gist options
  • Select an option

  • Save manko/1448145 to your computer and use it in GitHub Desktop.

Select an option

Save manko/1448145 to your computer and use it in GitHub Desktop.
Unit test for SC2 single-runloop append/remove problem
test("the DOM element is gone after doing append and remove in two separate runloops", function() {
var view = SC.View.create();
SC.run(function() {
view.append();
});
SC.run(function() {
view.remove();
});
var viewElem = SC.$('#'+get(view, 'elementId'));
ok(viewElem.length === 0, "view's element doesn't exist in DOM");
});
test("the DOM element is gone after doing append and remove in a single runloop", function() {
var view = SC.View.create();
SC.run(function() {
view.append();
view.remove();
});
var viewElem = SC.$('#'+get(view, 'elementId'));
ok(viewElem.length === 0, "view's element doesn't exist in DOM");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment