diff options
author | Misko Hevery | 2010-02-20 17:27:21 -0800 |
---|---|---|
committer | Misko Hevery | 2010-02-20 17:27:21 -0800 |
commit | b628de9758c313b106d22468f4b49bd223698fd5 (patch) | |
tree | cc2cc6737553ff7c1fbe7ba779520d4c4a63ab60 /test/BinderTest.js | |
parent | 97c02c9def42655e28ec86fed288ca363b152f9e (diff) | |
download | angular.js-b628de9758c313b106d22468f4b49bd223698fd5.tar.bz2 |
fix option value bug
Diffstat (limited to 'test/BinderTest.js')
-rw-r--r-- | test/BinderTest.js | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/test/BinderTest.js b/test/BinderTest.js index a3f1eac5..d565ee30 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -400,7 +400,7 @@ BinderTest.prototype.testRepeaterUpdateBindings = function(){ '<li ng-bind="item.a" ng-repeat-index="0">A</li>' + '<li ng-bind="item.a" ng-repeat-index="1">B</li>' + '</ul>', form.sortedHtml()); - + items.shift(); items.shift(); a.binder.updateView(); @@ -761,10 +761,20 @@ BinderTest.prototype.testSettingAnchorToNullOrUndefinedRemovesTheAnchorFromURL = }; BinderTest.prototype.testFillInOptionValueWhenMissing = function() { - var c = compile('<select><option selected="true">A</option><option value="">B</option></select>'); - assertEquals( - '<select><option selected="true" value="A">A</option><option>B</option></select>', - c.node.sortedHtml()); + var c = compile( + '<select><option selected="true">{{a}}</option><option value="">{{b}}</option><option>C</option></select>'); + c.scope.set('a', 'A'); + c.scope.set('b', 'B'); + c.binder.updateView(); + + expect(c.node.find("option:first").attr('value')).toEqual('A'); + expect(c.node.find("option:first").text()).toEqual('A'); + + expect(c.node.find("option:nth-child(2)").attr('value')).toEqual(''); + expect(c.node.find("option:nth-child(2)").text()).toEqual('B'); + + expect(c.node.find("option:last").attr('value')).toEqual('C'); + expect(c.node.find("option:last").text()).toEqual('C'); }; BinderTest.prototype.testValidateForm = function() { @@ -972,7 +982,7 @@ BinderTest.prototype.testItShouldRenderMultiRootHtmlInBinding = function() { x.scope.set("a", "a<b>c</b>d"); x.binder.updateView(); assertEquals( - '<div>before <span ng-bind="a|html">a<b>c</b>d</span>after</div>', + '<div>before <span ng-bind="a|html">a<b>c</b>d</span>after</div>', x.node.sortedHtml()); }; |