From 9f919c42f0885e39870195fab8ce2a22621119b7 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 4 Feb 2010 14:02:20 -0800 Subject: better handling of $invalidWidgets --- test/BinderTest.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/BinderTest.js b/test/BinderTest.js index 41319b52..f10ed9b1 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -3,7 +3,7 @@ BinderTest = TestCase('BinderTest'); function compile(content, initialScope, config) { var h = html(content); config = config || {autoSubmit:true}; - var scope = new Scope(initialScope, "ROOT"); + var scope = new Scope($.extend({$invalidWidgets:[]}, initialScope), "ROOT"); h.data('scope', scope); var datastore = new DataStore(); var binder = new Binder(h[0], new WidgetFactory(), datastore, new MockLocation(), config); @@ -875,18 +875,15 @@ BinderTest.prototype.testParseQueryString = function(){ BinderTest.prototype.testSetBinderAnchorTriggersListeners = function(){ expectAsserts(2); - var doc = html("
")[0]; - var binder = new Binder(doc, null, null, new MockLocation()); - var scope = new Scope({$binder:binder, $anchor:binder.anchor}); - jQuery(doc).data('scope', scope); + var doc = compile("
"); - scope.addWatchListener("$anchor.name", function(newVal, oldVal) { + doc.scope.addWatchListener("$anchor.name", function(newVal, oldVal) { assertEquals("new", newVal); assertEquals(undefined, oldVal); }); - binder.anchor.name = "new"; - binder.onUrlChange("http://base#name=new"); + doc.binder.anchor.name = "new"; + doc.binder.onUrlChange("http://base#name=new"); }; BinderTest.prototype.testItShouldDisplayErrorWhenActionIsSyntacticlyIncorect = function(){ -- cgit v1.2.3