Skip to content

Commit ee6a7a1

Browse files
committed
* Minor refactor of temperature component and spec
1 parent 23ecca2 commit ee6a7a1

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

specs/temp.spec.js renamed to specs/temperature.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Temperature from '@/temprature'
1+
import Temperature from '@/temperature'
22
import { mount } from '@vue/test-utils'
33

44
describe('Computed Properties Tests', () => {

src/temprature.vue renamed to src/temperature.vue

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@ export default {
1818
1919
computed: {
2020
celsius() {
21-
if (this.type == 'celsius')
22-
return this.degrees
21+
if (this.type === 'celsius')
22+
return this.degrees;
2323
else
24-
return parseInt((this.degrees - 32) * 0.556)
24+
return parseInt((this.degrees - 32) * 0.556);
2525
},
2626
2727
fahrenheit() {
28-
if (this.type == 'fahrenheit')
29-
return this.degrees
28+
if (this.type === 'fahrenheit')
29+
return this.degrees;
3030
else
31-
return (this.degrees * 1.8) + 32
31+
return (this.degrees * 1.8) + 32;
3232
}
3333
},
3434
3535
watch: {
3636
temp: {
3737
immediate: true,
3838
handler: function(val) {
39-
if (!val) return
40-
this.degrees = parseInt(val)
41-
this.type = String(val).endsWith('f') ? 'fahrenheit' : 'celsius'
39+
if (!val) return;
40+
this.degrees = parseInt(val);
41+
this.type = String(val).endsWith('f') ? 'fahrenheit' : 'celsius';
4242
}
4343
}
4444
}

0 commit comments

Comments
 (0)