Skip to content

Commit

Permalink
Enrich test case of hiding remove choice button
Browse files Browse the repository at this point in the history
  • Loading branch information
leung018 committed May 27, 2024
1 parent 2a50ff7 commit c02540a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/app/components/editor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ class UIServiceInteractor {
)
}

clickRemoveChoice({ choiceNumber }: { choiceNumber: number }) {
fireEvent.click(this.queryRemoveChoiceButton({ choiceNumber })!)
return this
}

clickAddChoice() {
const addChoiceButtons = screen.getAllByText('Add Choice')
fireEvent.click(addChoiceButtons[this.questionNumberFocus - 1])
Expand Down Expand Up @@ -581,6 +586,14 @@ describe('QuestionSetEditor', () => {
interactor.setQuestionNumberFocus(1)
expect(interactor.queryRemoveChoiceButton({ choiceNumber: 1 })).toBeNull()
expect(interactor.queryRemoveChoiceButton({ choiceNumber: 2 })).toBeNull()

interactor.clickAddChoice()
interactor.clickRemoveChoice({ choiceNumber: 1 })

//: TODO: Uncomment below when action that is triggered by remove choice button is implemented
// expect(interactor.queryRemoveChoiceButton({ choiceNumber: 1 })).toBeNull()
// expect(interactor.queryRemoveChoiceButton({ choiceNumber: 2 })).toBeNull()
// expect(interactor.queryRemoveChoiceButton({ choiceNumber: 3 })).toBeNull()
})
})

Expand Down

0 comments on commit c02540a

Please sign in to comment.