Skip to content

Commit

Permalink
test(intg): ensure proper selector & element
Browse files Browse the repository at this point in the history
  • Loading branch information
lemredd committed Dec 22, 2022
1 parent 1e13ba7 commit 74562db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/CalculatorContainer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import Component from "./CalculatorContainer.vue"
describe("Component: CalculatorContainer", () => {
it("can evaluate a proper expression", async() => {
const wrapper = mount(Component)
const evaluationScrn = wrapper.find(".evaluation-screen").element as HTMLInputElement
const evaluationScrn = wrapper.find(".evaluation-screen")
const entryScrn = wrapper.find(".entry-screen").element as HTMLInputElement

// Find the digit "1" button and click it
const digitalBtns = wrapper.findAll(".digital-button")
const [digital1Btn] = digitalBtns.filter(btn => btn.text() === "1")
await digital1Btn.trigger("click")
expect(entryScrn.value).toEqual("1")
expect(evaluationScrn.value).toEqual("")
expect(evaluationScrn.text()).toEqual("")

// Find the Addition button and click it
const operationalBtns = wrapper.findAll(".operational-button")
const [additionBtn] = operationalBtns.filter(btn => btn.text() === "+")
await additionBtn.trigger("click")
expect(evaluationScrn.value).toEqual("1 +")
expect(evaluationScrn.text()).toEqual("1 +")

// click digit "1" button again
await digital1Btn.trigger("click")
Expand All @@ -29,7 +29,7 @@ describe("Component: CalculatorContainer", () => {
const evaluationBtns = wrapper.findAll(".evaluation-button")
const [equalBtn] = evaluationBtns.filter(btn => btn.text() === "=")
await equalBtn.trigger("click")
expect(evaluationScrn.value).toEqual("1 + 1 =")
expect(evaluationScrn.text()).toEqual("1 + 1 =")
expect(entryScrn.value).toEqual("2")
})

Expand Down

0 comments on commit 74562db

Please sign in to comment.