From c4ef1f2fdd73bdaeda879e596d3d96e4e68cb6fd Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 8 Apr 2010 13:43:40 -0700 Subject: tests failing jstd to show cory --- test/BinderTest.js | 155 ++++------------------------------------------------- 1 file changed, 10 insertions(+), 145 deletions(-) (limited to 'test/BinderTest.js') diff --git a/test/BinderTest.js b/test/BinderTest.js index 270fd1c7..e72afa9f 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -174,34 +174,6 @@ BinderTest.prototype.testButtonElementActionExecutesInScope = function(){ assertTrue(savedCalled); }; -BinderTest.prototype.XtestParseEmptyAnchor = function(){ - var binder = this.compile("
").binder; - var location = binder.location; - var anchor = binder.anchor; - location.url = "a#x=1"; - binder.parseAnchor(); - assertEquals(1, binder.anchor.x); - location.url = "a#"; - binder.parseAnchor(); - assertTrue("old values did not get removed", !binder.anchor.x); - assertTrue("anchor gor replaced", anchor === binder.anchor); - assertEquals('undefined', typeof (anchor[""])); -}; - -BinderTest.prototype.XtestParseAnchor = function(){ - var binder = this.compile("
").binder; - var location = binder.location; - location.url = "a#x=1"; - binder.parseAnchor(); - assertEquals(binder.anchor.x, "1"); - location.url = "a#a=b&c=%20&d"; - binder.parseAnchor(); - assertEquals(binder.anchor.a, 'b'); - assertEquals(binder.anchor.c, ' '); - assertTrue(binder.anchor.d !== null); - assertTrue(!binder.anchor.x); -}; - BinderTest.prototype.testRepeaterUpdateBindings = function(){ var a = this.compile(''); var form = a.node; @@ -355,18 +327,6 @@ BinderTest.prototype.testNestedRepeater = function() { '
', sortedHtml(a.node)); }; -BinderTest.prototype.XtestRadioButtonGetsPrefixed = function () { - var a = this.compile('
'); - a.scope.$set('model', ['a1', 'a2']); - a.scope.$eval(); - - assertEquals('' + - '<#comment>'+ - ''+ - '', - sortedHtml(a.node)); -}; - BinderTest.prototype.testHideBindingExpression = function() { var a = this.compile('
'); @@ -525,31 +485,6 @@ BinderTest.prototype.testShouldTemplateBindPreElements = function () { assertEquals('
Hello World!
', sortedHtml(c.node)); }; -BinderTest.prototype.XtestDissableAutoSubmit = function() { - var c = this.compile('', null, {autoSubmit:true}); - assertEquals( - '', - sortedHtml(c.node)); - - c = this.compile('', null, {autoSubmit:false}); - assertEquals( - '', - sortedHtml(c.node)); -}; - -BinderTest.prototype.XtestSettingAnchorToNullOrUndefinedRemovesTheAnchorFromURL = function() { - var c = this.compile(''); - c.binder.location.set("http://server/#a=1&b=2"); - c.binder.parseAnchor(); - assertEquals('1', c.binder.anchor.a); - assertEquals('2', c.binder.anchor.b); - - c.binder.anchor.a = null; - c.binder.anchor.b = null; - c.binder.updateAnchor(); - assertEquals('http://server/#', c.binder.location.get()); -}; - BinderTest.prototype.testFillInOptionValueWhenMissing = function() { var c = this.compile( ''); @@ -570,9 +505,11 @@ BinderTest.prototype.testFillInOptionValueWhenMissing = function() { expect(optionC.text()).toEqual('C'); }; -BinderTest.prototype.XtestValidateForm = function() { - var c = this.compile('' + - '
'); +BinderTest.prototype.testValidateForm = function() { + var doc = jqLite(document.body); + doc.append('
' + + '
'); + var c = this.compile(doc); var items = [{}, {}]; c.scope.$set("items", items); c.scope.$eval(); @@ -599,8 +536,9 @@ BinderTest.prototype.XtestValidateForm = function() { assertEquals(0, c.scope.$get("$invalidWidgets.length")); }; -BinderTest.prototype.XtestValidateOnlyVisibleItems = function(){ - var c = this.compile(''); +BinderTest.prototype.testValidateOnlyVisibleItems = function(){ + var c = this.compile('
'); + jqLite(document.body).append(c.node); c.scope.$set("show", true); c.scope.$eval(); assertEquals(2, c.scope.$get("$invalidWidgets.length")); @@ -629,62 +567,6 @@ BinderTest.prototype.testDeleteAttributeIfEvaluatesFalse = function() { assertChild(5, false); }; -BinderTest.prototype.XtestItShouldCallListenersWhenAnchorChanges = function() { - var log = ""; - var c = this.compile('
'); - c.scope.$set("count", 0); - c.scope.$watch("$anchor.counter", function(newValue, oldValue){ - log += oldValue + "->" + newValue + ";"; - }); - assertEquals(0, c.scope.$get("count")); - c.binder.location.url = "#counter=1"; - c.binder.onUrlChange(); - assertEquals(1, c.scope.$get("count")); - - c.binder.location.url = "#counter=1"; - c.binder.onUrlChange(); - assertEquals(1, c.scope.$get("count")); - - c.binder.location.url = "#counter=2"; - c.binder.onUrlChange(); - assertEquals(2, c.scope.$get("count")); - - c.binder.location.url = "#counter=2"; - c.binder.onUrlChange(); - assertEquals(2, c.scope.$get("count")); - - c.binder.location.url = "#"; - c.binder.onUrlChange(); - assertEquals("undefined->1;1->2;2->undefined;", log); - assertEquals(3, c.scope.$get("count")); -}; - -BinderTest.prototype.XtestParseQueryString = function(){ - var binder = new Binder(); - assertJsonEquals({"a":"1"}, binder.parseQueryString("a=1")); - assertJsonEquals({"a":"1", "b":"two"}, binder.parseQueryString("a=1&b=two")); - assertJsonEquals({}, binder.parseQueryString("")); - - assertJsonEquals({"a":"1", "b":""}, binder.parseQueryString("a=1&b=")); - assertJsonEquals({"a":"1", "b":""}, binder.parseQueryString("a=1&b")); - assertJsonEquals({"a":"1", "b":" 2 "}, binder.parseQueryString("a=1&b=%202%20")); - assertJsonEquals({"a a":"1", "b":"2"}, binder.parseQueryString("a%20a=1&b=2")); - -}; - -BinderTest.prototype.XtestSetBinderAnchorTriggersListeners = function(){ - expectAsserts(2); - var doc = this.compile("
"); - - doc.scope.$watch("$anchor.name", function(newVal, oldVal) { - assertEquals("new", newVal); - assertEquals(undefined, oldVal); - }); - - doc.$anchor.name = "new"; - doc.binder.onUrlChange("http://base#name=new"); -}; - BinderTest.prototype.testItShouldDisplayErrorWhenActionIsSyntacticlyIncorect = function(){ var c = this.compile('
' + '' + @@ -768,9 +650,9 @@ BinderTest.prototype.testItBindHiddenInputFields = function(){ assertEquals("abc", x.scope.$get("myName")); }; -BinderTest.prototype.xtestItShouldRenderMultiRootHtmlInBinding = function() { +BinderTest.prototype.XtestItShouldRenderMultiRootHtmlInBinding = function() { var x = this.compile('
before {{a|html}}after
'); - x.scope.$set("a", "acd"); + x.scope.a = "acd"; x.scope.$eval(); assertEquals( '
before acdafter
', @@ -790,20 +672,3 @@ BinderTest.prototype.testItShouldUseFormaterForText = function() { assertEquals('1, 2, 3', input[0].value); }; -BinderTest.prototype.XtestWriteAnchor = function(){ - var binder = this.compile("
").binder; - binder.location.set('a'); - binder.anchor.a = 'b'; - binder.anchor.c = ' '; - binder.anchor.d = true; - binder.updateAnchor(); - assertEquals(binder.location.get(), "a#a=b&c=%20&d"); -}; - -BinderTest.prototype.XtestWriteAnchorAsPartOfTheUpdateView = function(){ - var binder = this.compile("
").binder; - binder.location.set('a'); - binder.anchor.a = 'b'; - binder.updateView(); - assertEquals(binder.location.get(), "a#a=b"); -}; -- cgit v1.2.3