From b3cae4f457f1688346bbd0b08cccc9c504f83406 Mon Sep 17 00:00:00 2001
From: Sudhir Jonathan
Date: Sun, 21 Oct 2012 12:57:27 +0530
Subject: 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
---
test/ng/directive/selectSpec.js | 15 +++++++++++++++
1 file changed, 15 insertions(+)
(limited to 'test/ng/directive')
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('');
});
+ 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('');
+ expect(sortedHtml(options[1])).toEqual('');
+ expect(sortedHtml(options[2])).toEqual('');
+ });
+
it('should render an object', function() {
createSelect({
--
cgit v1.2.3