Skip to content

Commit

Permalink
fill out getWarningState() test
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Nov 15, 2023
1 parent 2804d91 commit 4910a28
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/javascript/__tests__/validated_form.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,24 @@ describe('NonDrivingContactMediumWarning', () => {
let component

beforeEach(() => {
component = new NonDrivingContactMediumWarning(validatedFormCollection.find('.contact-medium.form-group input:not([type=hidden]), #case_contact_miles_driven'), notifier)
component = new NonDrivingContactMediumWarning($('.contact-medium.form-group input:not([type=hidden]), #case_contact_miles_driven'), notifier)
})

test('returns the warning message if a non driving contact medium is selected and the miles driven count is > 0', (done) => {
$(() => {
try {
expect(nonDrivingOptions.length).toBeGreaterThan(0)

milesDrivenInput.val(1)

nonDrivingOptions.each(function () {
const option = $(this)

option.trigger('click')

expect(component.getWarningState()).toBe('You requested driving reimbursement for a contact medium that typically does not involve driving. Are you sure that\'s right?')
})

done()
} catch (error) {
done(error)
Expand Down

0 comments on commit 4910a28

Please sign in to comment.