Skip to content

Commit

Permalink
refactor(@dpc-sdp/ripple-ui-forms): use input instead of change event…
Browse files Browse the repository at this point in the history
… for form_start event

now fires immediately instead of waiting for blur of the field
  • Loading branch information
jeffdowdle committed Sep 18, 2024
1 parent 9f4a26c commit 2cc23d2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Feature: Forms analytics events
And the site endpoint returns fixture "/site/reference" with status 200
Given I visit the page "/"
When I type "Cat" into the input with the label "Last name"
When I blur the input with the label "Last name"
Then the dataLayer should include the following events
| event | form_id | form_name | component | platform_event |
| form_start | full_form | Test form | rpl-form | start |
10 changes: 0 additions & 10 deletions packages/ripple-test-utils/step_definitions/components/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,6 @@ When(
}
)

When('I blur the input with the label {string}', (label: string) => {
cy.get('label.rpl-form-label')
.contains(label)
.closest('.rpl-form__outer')
.as('field')

cy.get('@field').should('exist')
cy.get('@field').find('input').blur()
})

When(
'I type {string} into the textarea with the label {string}',
(value: string, label: string) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/ripple-ui-forms/src/components/RplForm/RplForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const emit = defineEmits<{
(e: 'submit', payload: rplEventPayload & { action: 'submit' }): void
(e: 'invalid', payload: rplEventPayload & { action: 'submit' }): void
(e: 'submitted', payload: rplEventPayload & { action: 'complete' }): void
(e: 'start', payload: rplEventPayload): void
}>()
const { emitRplEvent } = useRippleEvent('rpl-form', emit)
Expand Down Expand Up @@ -275,7 +276,7 @@ const plugins = computed(
novalidate
@submit-invalid="submitInvalidHandler"
@submit="submitHandler"
@change="handleChange"
@input="handleChange"
>
<fieldset
class="rpl-form__submit-guard"
Expand Down

0 comments on commit 2cc23d2

Please sign in to comment.