Skip to content

Commit

Permalink
chore(component): rename to DigitalButtons
Browse files Browse the repository at this point in the history
fix #29
  • Loading branch information
lemredd committed Dec 20, 2022
1 parent 65c8b21 commit ac0e3c5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/components/CalculatorContainer.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref } from "vue"
import Button from "@/CalculatorContainer/CalculatorButton.vue"
import Button from "@/CalculatorContainer/DigitalButton.vue"
import Screen from "@/CalculatorContainer/CalculatorScreen.vue"
const valueToDisplay = ref("0")
Expand Down
20 changes: 0 additions & 20 deletions src/components/CalculatorContainer/CalculatorButton.test.ts

This file was deleted.

20 changes: 20 additions & 0 deletions src/components/CalculatorContainer/DigitalButton.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { shallowMount } from "@vue/test-utils"

import Component from "./DigitalButton.vue"

describe("Component: CalculatorContainer/DigitalButton", () => {
it("can emit custom value", async() => {
const wrapper = shallowMount(Component, {
"props": {
"value": 1
}
})
const digitalBtn = wrapper.find("button.digital-button")
const digitalBtnValue = wrapper.props("value")
expect(digitalBtn.text()).toEqual(String(digitalBtnValue))

await digitalBtn.trigger("click")
const expectedEmission = wrapper.emitted("appendToScreen")
expect(expectedEmission).toHaveProperty("0.0", digitalBtnValue)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function appendToScreen() {
</script>

<template>
<button class="calculator-button" @click="appendToScreen">
<button class="digital-button" @click="appendToScreen">
{{ props.value }}
</button>
</template>
Expand Down

0 comments on commit ac0e3c5

Please sign in to comment.