Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

the currency binding should now render non-numeric values as 'NaN' in…

…stead of e.g. $0.00
  • Loading branch information...
commit 6105bfefbfec2cc5daf32922964d43bb4dcca860 1 parent cf9cc09
politician authored
Showing with 11 additions and 1 deletion.
  1. +1 −1  outback.js
  2. +10 −0 spec/bindings/currency.spec.js
2  outback.js
View
@@ -1073,7 +1073,7 @@
config = optionsFor(valueAccessor, allBindingsAccessor);
value = valueAccessor()();
- value = formatMoney.apply(value, [2].concat(config.format));
+ value = _.isNaN(+value) ? 'NaN' : formatMoney.apply(value, [2].concat(config.format));
$(element).text(value);
},
10 spec/bindings/currency.spec.js
View
@@ -62,4 +62,14 @@ describe('the currency binding', function() {
expect(this.el.text()).toBe('$3.14');
});
+
+
+ it('should render non-numeric values as "NaN"', function() {
+ this.view.render();
+ this.el = this.view.$('#anchor span');
+
+ this.model.set({price: 'foo' });
+
+ expect(this.el.text()).toBe('NaN');
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.