Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/components/step_indicator_component.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class StepIndicatorComponent < BaseComponent
attr_reader :current_step, :locale_scope, :tag_options

ALL_STEPS_COMPLETE = :all_steps_complete

def initialize(steps:, current_step:, locale_scope: nil, **tag_options)
@steps = steps
@current_step = current_step
Expand All @@ -19,6 +21,8 @@ def steps
private

def step_status(step)
return :complete if current_step == ALL_STEPS_COMPLETE

if step[:name] == current_step
:current
elsif step_index(step[:name]) < step_index(current_step)
Expand Down
2 changes: 1 addition & 1 deletion app/views/idv/personal_key/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% content_for(:pre_flash_content) do %>
<%= render StepIndicatorComponent.new(
steps: step_indicator_steps,
current_step: :secure_account,
current_step: StepIndicatorComponent::ALL_STEPS_COMPLETE,
locale_scope: 'idv',
class: 'margin-x-neg-2 margin-top-neg-4 tablet:margin-x-neg-6 tablet:margin-top-neg-4',
) %>
Expand Down
23 changes: 23 additions & 0 deletions spec/components/step_indicator_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,29 @@
)
end
end

context 'all steps complete' do
let(:current_step) { StepIndicatorComponent::ALL_STEPS_COMPLETE }

it 'renders current step' do
expect(rendered).not_to have_css('.step-indicator__step--current')
end

it 'renders all steps completed' do
expect(rendered).to have_css(
'.step-indicator__step--complete',
text: t('step_indicator.flows.example.one'),
)
expect(rendered).to have_css(
'.step-indicator__step--complete',
text: t('step_indicator.flows.example.two'),
)
expect(rendered).to have_css(
'.step-indicator__step--complete',
text: t('step_indicator.flows.example.three'),
)
end
end
end

describe 'locale_scope' do
Expand Down
6 changes: 5 additions & 1 deletion spec/features/idv/end_to_end_idv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,15 @@ def validate_personal_key_page
expect(page).to have_content(t('forms.personal_key_partial.acknowledgement.text'))
expect(page).to have_content(t('forms.personal_key_partial.acknowledgement.help_link_text'))
expect(page).to have_content(t('idv.messages.confirm'))
expect_step_indicator_current_step(t('step_indicator.flows.idv.secure_account'))
expect(page).to have_css(
'.step-indicator__step--complete',
text: t('step_indicator.flows.idv.verify_phone_or_address'),
)
expect(page).to have_css(
'.step-indicator__step--complete',
text: t('step_indicator.flows.idv.secure_account'),
)
expect(page).not_to have_css('.step-indicator__step--current')
expect(page).not_to have_content(t('step_indicator.flows.idv.get_a_letter'))

# Refreshing shows same page (BUT with new personal key, we should warn the user)
Expand Down
9 changes: 6 additions & 3 deletions spec/features/idv/in_person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
complete_enter_password_step(user)

# personal key page
expect_in_person_step_indicator_current_step(t('step_indicator.flows.idv.secure_account'))
expect_in_person_step_indicator
expect(page).not_to have_css('.step-indicator__step--current')
expect(page).to have_content(t('titles.idv.personal_key'))
deadline = nil
freeze_time do
Expand Down Expand Up @@ -292,7 +293,8 @@
click_button t('idv.gpo.form.submit')

# personal key
expect_in_person_step_indicator_current_step(t('step_indicator.flows.idv.secure_account'))
expect_in_person_step_indicator
expect(page).not_to have_css('.step-indicator__step--current')
expect(page).to have_content(t('titles.idv.personal_key'))
acknowledge_and_confirm_personal_key

Expand Down Expand Up @@ -502,7 +504,8 @@
complete_enter_password_step(user)

# personal key page
expect_in_person_step_indicator_current_step(t('step_indicator.flows.idv.secure_account'))
expect_in_person_step_indicator
expect(page).not_to have_css('.step-indicator__step--current')
expect(page).to have_content(t('titles.idv.personal_key'))
deadline = nil
freeze_time do
Expand Down
3 changes: 2 additions & 1 deletion spec/features/idv/in_person_threatmetrix_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def deactivate_profile_update_enrollment(status:)
complete_enter_password_step(user)

# personal key page
expect_in_person_step_indicator_current_step(t('step_indicator.flows.idv.secure_account'))
expect_in_person_step_indicator
expect(page).not_to have_css('.step-indicator__step--current')
expect(page).to have_content(t('titles.idv.personal_key'))
deadline = nil
freeze_time do
Expand Down
9 changes: 6 additions & 3 deletions spec/features/idv/steps/in_person_opt_in_ipp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
complete_enter_password_step(user)

# personal key page
expect_in_person_step_indicator_current_step(t('step_indicator.flows.idv.secure_account'))
expect_in_person_step_indicator
expect(page).not_to have_css('.step-indicator__step--current')
expect(page).to have_content(t('titles.idv.personal_key'))
deadline = nil
freeze_time do
Expand Down Expand Up @@ -222,7 +223,8 @@
complete_enter_password_step(user)

# personal key page
expect_in_person_step_indicator_current_step(t('step_indicator.flows.idv.secure_account'))
expect_in_person_step_indicator
expect(page).not_to have_css('.step-indicator__step--current')
expect(page).to have_content(t('titles.idv.personal_key'))
deadline = nil
freeze_time do
Expand Down Expand Up @@ -380,7 +382,8 @@
complete_enter_password_step(user)

# personal key page
expect_in_person_step_indicator_current_step(t('step_indicator.flows.idv.secure_account'))
expect_in_person_step_indicator
expect(page).not_to have_css('.step-indicator__step--current')
expect(page).to have_content(t('titles.idv.personal_key'))
deadline = nil
freeze_time do
Expand Down
7 changes: 5 additions & 2 deletions spec/support/features/in_person_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,18 @@ def complete_entire_ipp_flow(user = user_with_2fa, tmx_status = nil, same_addres
end

def expect_in_person_step_indicator_current_step(text)
expect_in_person_step_indicator
expect_step_indicator_current_step(text)
end

def expect_in_person_step_indicator
# Normally we're only concerned with the "current" step, but since some steps are shared between
# flows, we also want to make sure that at least one of the in-person-specific steps exists in
# the step indicator.
expect(page).to have_css(
'.step-indicator__step',
text: t('step_indicator.flows.idv.find_a_post_office'),
)

expect_step_indicator_current_step(text)
end

def expect_in_person_gpo_step_indicator_current_step(text)
Expand Down