From b628de9758c313b106d22468f4b49bd223698fd5 Mon Sep 17 00:00:00 2001
From: Misko Hevery
Date: Sat, 20 Feb 2010 17:27:21 -0800
Subject: fix option value bug
---
test/BinderTest.js | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
(limited to 'test')
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(){
'
A' +
'B' +
'', form.sortedHtml());
-
+
items.shift();
items.shift();
a.binder.updateView();
@@ -761,10 +761,20 @@ BinderTest.prototype.testSettingAnchorToNullOrUndefinedRemovesTheAnchorFromURL =
};
BinderTest.prototype.testFillInOptionValueWhenMissing = function() {
- var c = compile('');
- assertEquals(
- '',
- c.node.sortedHtml());
+ var c = compile(
+ '');
+ 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", "acd");
x.binder.updateView();
assertEquals(
- 'before acdafter
',
+ 'before acdafter
',
x.node.sortedHtml());
};
--
cgit v1.2.3