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
2 changes: 0 additions & 2 deletions app/controllers/idv/personal_key_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ def show
add_proofing_component

finish_idv_session

@confirm = FeatureManagement.idv_personal_key_confirmation_enabled? ? 'modal' : 'skip'
end

def update
Expand Down
3 changes: 0 additions & 3 deletions app/javascript/packages/verify-flow/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ export { default as Cancel } from './cancel';
export { default as VerifyFlow } from './verify-flow';
export { default as VerifyFlowStepIndicator, VerifyFlowPath } from './verify-flow-step-indicator';

export { default as personalKeyStep } from './steps/personal-key';
export { default as personalKeyConfirmStep } from './steps/personal-key-confirm';
Comment on lines -9 to -10
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this just removes the imports, but doesn't remove the steps themselves. are those still being used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're still being used, but the usage is internal to the verify-flow package. These were exported here so that they could be referenced directly in the verify-personal-key pack being removed here.


export type { FlowContextValue } from './context/flow-context';
export type { SecretValues } from './context/secrets-context';
export type { AddressVerificationMethod } from './context/address-verification-method-context';
Expand Down
24 changes: 0 additions & 24 deletions app/javascript/packs/verify-personal-key.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/shared/_personal_key.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
t('forms.buttons.continue'),
update_path,
class: 'display-block usa-button usa-button--big usa-button--wide personal-key-continue margin-top-5',
'data-toggle': @confirm,
'data-toggle': FeatureManagement.idv_personal_key_confirmation_enabled? ? 'modal' : 'skip',
) %>
<%= render 'shared/personal_key_confirmation_modal', code: code, update_path: update_path %>
<%== javascript_packs_tag_once 'personal-key-page-controller' %>
6 changes: 1 addition & 5 deletions app/views/users/personal_keys/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<% title t('titles.personal_key') %>

<%= form_tag(manage_personal_key_path, method: 'post', id: 'app-form') %>
<%= content_tag(:div, '', id: 'app-root', data: { personal_key: @code }) do %>
<%= render 'shared/personal_key', code: @code, update_path: manage_personal_key_path %>
<% end %>
<%= javascript_packs_tag_once('verify-personal-key') %>
<%= render('shared/personal_key', code: @code, update_path: manage_personal_key_path) %>
29 changes: 27 additions & 2 deletions spec/views/shared/_personal_key.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
RSpec.describe 'shared/_personal_key.html.erb' do
let(:personal_key) { RandomPhrase.new(num_words: 4).to_s }

subject(:rendered) { render 'shared/personal_key', code: personal_key, update_path: '/test' }

describe 'download link' do
around do |ex|
# data_uri depends on URI.decode which was removed in Ruby 3.0 :sob:
Expand All @@ -19,8 +21,6 @@ def self.decode(value)
end

it 'has the download attribute and a data: url for the personal key' do
render 'shared/personal_key', code: personal_key, update_path: '/test'

doc = Nokogiri::HTML(rendered)
download_link = doc.at_css('a[download]')
data_uri = URI::Data.new(download_link[:href])
Expand All @@ -29,4 +29,29 @@ def self.decode(value)
expect(data_uri.data).to eq(personal_key)
end
end

describe 'continue button' do
let(:idv_personal_key_confirmation_enabled) { nil }

before do
allow(FeatureManagement).to receive(:idv_personal_key_confirmation_enabled?).
and_return(idv_personal_key_confirmation_enabled)
end

context 'without idv personal key confirmation' do
let(:idv_personal_key_confirmation_enabled) { false }

it 'renders button with [data-toggle="skip"]' do
expect(rendered).to have_css('[data-toggle="skip"]')
end
end

context 'with idv personal key confirmation' do
let(:idv_personal_key_confirmation_enabled) { true }

it 'renders button with [data-toggle="modal"]' do
expect(rendered).to have_css('[data-toggle="modal"]')
end
end
end
end