Skip to content

Commit

Permalink
✅ scaleStyleのテスト追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-aiuto committed May 18, 2021
1 parent 000a277 commit 8c0a0b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions spec/app/pages/timer-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,20 @@ jest.mock('@/app/time-up-audio')

describe('TimerPage', () => {
testMountComponent(() => factory({ shallow: false }))

describe('computed', () => {
describe('scaleStyle', () => {
it('style用のオブジェクトを返すこと', () => {
const wrapper = factory()
wrapper.vm.scale = 1
expect(wrapper.vm.scaleStyle).toEqual({ transform: 'scale(1)' })

wrapper.vm.scale = 0.5
expect(wrapper.vm.scaleStyle).toEqual({ transform: 'scale(0.5)' })

wrapper.vm.scale = 2
expect(wrapper.vm.scaleStyle).toEqual({ transform: 'scale(2)' })
})
})
})
})
4 changes: 2 additions & 2 deletions src/app/pages/timer-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<timer
time-up-audio-src="timer-timeup.mp3"
class="timer-wrapper"
:style="scaleClass"
:style="scaleStyle"
></timer>
</div>
</template>
Expand Down Expand Up @@ -37,7 +37,7 @@ export default class TimerPage extends Vue {
this.scale = 1
}
get scaleClass(): object {
get scaleStyle(): object {
return { transform: `scale(${this.scale})` }
}
}
Expand Down

0 comments on commit 8c0a0b6

Please sign in to comment.