animated-number-vue
Advanced tools
Comparing version
{ | ||
"name": "animated-number-vue", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -9,3 +9,3 @@ # animated-number-vue | ||
 | ||
 | ||
@@ -42,3 +42,3 @@ ## Usage | ||
formatToPrice(value) { | ||
return `R$ ${Number(value).toFixed(2)}`; | ||
return `R$ ${value.toFixed(2)}`; | ||
} | ||
@@ -72,3 +72,3 @@ } | ||
| --- | --- | --- | --- | ||
| formatValue | Function | value `String` | A function that will manipulate the animated value | | ||
| formatValue | Function | value `Number` | A function that will manipulate the animated value | | ||
| update | Function| animation `Object` | Called at time = 0 | ||
@@ -75,0 +75,0 @@ | run | Function| animation `Object` | Called after delay is finished |
@@ -60,4 +60,13 @@ import { shallow } from '@vue/test-utils'; | ||
it('should return a Number when formatValue function is passed', () => { | ||
const formatValue = value_ => value_; | ||
wrapper.setProps({ formatValue }); | ||
const formatedValue = wrapper.vm.formatValue(value); | ||
expect(formatedValue).toBe(value); | ||
expect(typeof formatedValue).toBe('number'); | ||
}); | ||
it('renders $ 10.00 when a format function is passsed', (done) => { | ||
const formatValue = value_ => `$ ${Number(value_).toFixed(2)}`; | ||
const formatValue = value_ => `$ ${value_.toFixed(2)}`; | ||
wrapper.setProps({ formatValue }); | ||
@@ -128,3 +137,2 @@ setTimeout(() => { | ||
setTimeout(() => { | ||
console.log(counter); | ||
expect(counter).toBeGreaterThan(30); | ||
@@ -131,0 +139,0 @@ done(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
186606
0.14%904
0.67%