removed fdescribe + refactor

This commit is contained in:
Carlos Jimenez 2018-11-20 10:15:40 +01:00
parent 56ab95ee73
commit e467a517fe
1 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,4 @@
fdescribe('Currency filter', () => {
describe('Currency filter', () => {
let compile;
let $element;
@ -11,17 +11,31 @@ fdescribe('Currency filter', () => {
});
};
it('should return the value formatted with two decimals when the value is a number and you set it a 2 as param', () => {
it('should return a ONE decimal number as per the argument', () => {
let html = `<div id="test" >{{200 | currency: '€': 1}}</div>`;
compile(html);
expect($element[0].innerHTML).toEqual('200.0 €');
});
it('should return a TWO decimals number as per the argument', () => {
let html = `<div id="test" >{{200 | currency: '€': 2}}</div>`;
compile(html);
expect($element[0].innerHTML).toBe('200.00 €');
expect($element[0].innerHTML).toEqual('200.00 €');
});
it('should return a TEN decimals number as per the argument', () => {
let html = `<div id="test" >{{200 | currency: '€': 10}}</div>`;
compile(html);
expect($element[0].innerHTML).toEqual('200.0000000000 €');
});
it('sould return nothing when the value is not set', () => {
let html = `<div id="test" >{{null | currency: '€': 2}}</div>`;
compile(html);
expect($element[0].innerHTML).toBe('');
expect($element[0].innerHTML).toEqual('');
});
});