aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSudhir Jonathan2012-10-21 12:57:27 +0530
committerIgor Minar2012-10-31 15:03:48 -0700
commitd981c2a3ecfaf572a836c7533ee3a9553aae327d (patch)
tree6b795cc0ce3905866a6c365404bb73874637dacd /test
parent537e20065a7f4aa0346713a186e25cc819125fae (diff)
downloadangular.js-d981c2a3ecfaf572a836c7533ee3a9553aae327d.tar.bz2
fix(select): select option with a label of 0 is not shown
Bug caused by the use of the `||` operator to replace all non-truthy values with an empty string. Changed to replace only `undefined` values. Closes #1401
Diffstat (limited to 'test')
-rw-r--r--test/ng/directive/selectSpec.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ng/directive/selectSpec.js b/test/ng/directive/selectSpec.js
index c63d17bf..7d17a185 100644
--- a/test/ng/directive/selectSpec.js
+++ b/test/ng/directive/selectSpec.js
@@ -493,6 +493,21 @@ describe('select', function() {
expect(sortedHtml(options[2])).toEqual('<option value="2">C</option>');
});
+ it('should render zero as a valid display value', function() {
+ createSingleSelect();
+
+ scope.$apply(function() {
+ scope.values = [{name: 0}, {name: 1}, {name: 2}];
+ scope.selected = scope.values[0];
+ });
+
+ var options = element.find('option');
+ expect(options.length).toEqual(3);
+ expect(sortedHtml(options[0])).toEqual('<option value="0">0</option>');
+ expect(sortedHtml(options[1])).toEqual('<option value="1">1</option>');
+ expect(sortedHtml(options[2])).toEqual('<option value="2">2</option>');
+ });
+
it('should render an object', function() {
createSelect({