Skip to content

Commit

Permalink
chore(component): prepare OperationalButton
Browse files Browse the repository at this point in the history
fix #30
  • Loading branch information
lemredd committed Dec 20, 2022
1 parent 4d27b23 commit aba0f92
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("Component: CalculatorContainer/OperationalButton", () => {
it("can emit custom value", async() => {
const wrapper = shallowMount(Component, {
"props": {
"value": 1
"value": "+"
}
})
const operationalBtn = wrapper.find("button.operational-button")
Expand Down
25 changes: 25 additions & 0 deletions src/components/CalculatorContainer/OperationalButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script setup lang="ts">
type Operations = "+"|"-"|"×"|"÷"
interface Props {
value: Operations
}
const props = defineProps<Props>()
interface CustomEvents {
(event: "appendToScreen", valueToAppend: string): void
}
const emit = defineEmits<CustomEvents>()
function appendToScreen() {
emit("appendToScreen", props.value)
}
</script>

<template>
<button class="operational-button" @click="appendToScreen">
{{ props.value }}
</button>
</template>

<style scoped lang="scss">
</style>

0 comments on commit aba0f92

Please sign in to comment.