23
23
it('should update', function(){
24
24
input('amount').enter('-1234');
25
25
expect(binding('amount | currency')).toBe('$-1,234.00');
26
- // TODO: implement
27
- // expect(binding('amount')).toHaveColor('red'); //what about toHaveCssClass instead?
26
+ expect(element('span[ng\\:bind="amount | currency"]').attr('class')).
27
+ toMatch(/ng-format-negative/);
28
28
});
29
29
*/
30
30
angularFilter . currency = function ( amount ) {
@@ -47,17 +47,23 @@ angularFilter.currency = function(amount){
47
47
* @returns {string } Number rounded to decimalPlaces and places a “,” after each third digit.
48
48
*
49
49
* @example
50
- <span ng:non-bindable>{{1234.56789 | number}}</span>: {{ 1234.56789 | number}} <br/>
51
- <span ng:non-bindable>{{1234.56789 | number:0}}</span>: {{1234.56789 | number:0 }}<br/>
52
- <span ng:non-bindable>{{1234.56789 | number:2}}</span>: {{1234.56789 | number:2 }}<br/>
53
- <span ng:non-bindable>{{-1234.56789 | number:4}}</span>: {{-1234.56789 | number:4}}
54
- *
50
+ Enter number: <input name='val' value=' 1234.56789' /> <br/>
51
+ Default formatting: {{val | number}}<br/>
52
+ No fractions: {{val | number:0 }}<br/>
53
+ Negative number: {{-val | number:4}}
54
+
55
55
* @scenario
56
56
it('should format numbers', function(){
57
- expect(binding('1234.56789 | number')).toBe('1,234.57');
58
- expect(binding('1234.56789 | number:0')).toBe('1,235');
59
- expect(binding('1234.56789 | number:2')).toBe('1,234.57');
60
- expect(binding('-1234.56789 | number:4')).toBe('-1,234.5679');
57
+ expect(binding('val | number')).toBe('1,234.57');
58
+ expect(binding('val | number:0')).toBe('1,235');
59
+ expect(binding('-val | number:4')).toBe('-1,234.5679');
60
+ });
61
+
62
+ it('should update', function(){
63
+ input('val').enter('3374.333');
64
+ expect(binding('val | number')).toBe('3,374.33');
65
+ expect(binding('val | number:0')).toBe('3,374');
66
+ expect(binding('-val | number:4')).toBe('-3,374.3330');
61
67
});
62
68
*/
63
69
angularFilter . number = function ( number , fractionSize ) {
@@ -238,12 +244,19 @@ angularFilter.date = function(date, format) {
238
244
*
239
245
* @css ng-monospace Always applied to the encapsulating element.
240
246
*
241
- * @example
242
- <span ng:non-bindable>{{ {a:1, b:[]} | json }}</span>: <pre>{{ {a:1, b:[]} | json }}</pre>
247
+ * @example :
248
+ <input type="text" name="objTxt" value="{a:1, b:[]}"
249
+ ng:eval="obj = $eval(objTxt)"/>
250
+ <pre>{{ obj | json }}</pre>
243
251
*
244
252
* @scenario
245
253
it('should jsonify filtered objects', function() {
246
- expect(binding('{{ {a:1, b:[]} | json')).toBe('{\n "a":1,\n "b":[]}');
254
+ expect(binding('obj | json')).toBe('{\n "a":1,\n "b":[]}');
255
+ });
256
+
257
+ it('should update', function() {
258
+ input('objTxt').enter('[1, 2, 3]');
259
+ expect(binding('obj | json')).toBe('[1,2,3]');
247
260
});
248
261
*
249
262
*/
@@ -401,8 +414,8 @@ and one more: ftp://127.0.0.1/.</textarea>
401
414
<td><div ng:bind="snippet"></div></td>
402
415
</tr>
403
416
</table>
404
- *
405
- * @scenario
417
+
418
+ @scenario
406
419
it('should linkify the snippet with urls', function(){
407
420
expect(using('#linky-filter').binding('snippet | linky')).
408
421
toBe('Pretty text with some links:\n' +
0 commit comments