Skip to content

Commit

Permalink
move turbolinks nonce header js out of application.js (#4894)
Browse files Browse the repository at this point in the history
* move turbolinks nonce header js out of application.js
* remove temporary cucumber fix steps
  • Loading branch information
RyanEddyIC authored and bbodine1 committed Jan 9, 2025
1 parent 2d61ace commit 1699a42
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 26 deletions.
7 changes: 6 additions & 1 deletion app/assets/javascripts/inline_replacements.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
document.addEventListener("turbolinks:request-start", function(event) {
var xhr = event.data.xhr;
xhr.setRequestHeader("X-Turbolinks-Nonce", $("meta[name='csp-nonce']").prop('content'));
});

$(document).on('click', ".remove-child-row-btn", function() {
$('tr.child-row:visible').remove();
});
Expand Down Expand Up @@ -50,7 +55,7 @@ $(document).on('click', '#priorSepModal .btn-confirmation', function() {

$(document).on('click', '.broker-staff-registration-container span.search', function() {
// components/benefit_sponsors/app/views/benefit_sponsors/profiles/broker_agencies/broker_agency_staff_roles/_new_staff_applicant.html.erb
brokerSearch();
brokerSearch();
return false
});

Expand Down
4 changes: 0 additions & 4 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import 'channels';

Rails.start()
Turbolinks.start()
document.addEventListener("turbolinks:request-start", function(event) {
var xhr = event.data.xhr;
xhr.setRequestHeader("X-Turbolinks-Nonce", $("meta[name='csp-nonce']").prop('content'));
});

const importAll = (r) => r.keys().map(r)
importAll(require.context('../images', false, /\.(png|jpe?g|svg|ico)$/));
Expand Down
4 changes: 0 additions & 4 deletions app/javascript/packs/no_jquery_application.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ import 'sweetalert2';
import 'channels';

Turbolinks.start()
document.addEventListener("turbolinks:request-start", function(event) {
var xhr = event.data.xhr;
xhr.setRequestHeader("X-Turbolinks-Nonce", $("meta[name='csp-nonce']").prop('content'));
});

const importAll = (r) => r.keys().map(r)
importAll(require.context('../images', false, /\.(png|jpe?g|svg|ico)$/));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
end
# should be on checklist page now
find('a.interaction-click-control-continue').click

# temporary fix for content_security_policy_nonce returning nil on page load
refresh
end

When(/^.+ click 'Start New Application' button$/) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
end

Then(/^the user will navigate to the Other Income page for the corresponding applicant$/) do
refresh
sleep 2
expect(page).to have_content l10n('faa.nav.other_income')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
find(IvlIapJobIncomeInformationPage.continue_btn).click

if FinancialAssistanceRegistry[:unemployment_income].enabled?
# temporary fix for content_security_policy_nonce returning nil on page load
refresh
sleep 1

find(IvlIapOtherIncomePage.has_unemployment_income_yes_radiobtn).click
sleep 1
fill_in IvlIapOtherIncomePage.income_amount, with: '100'
Expand All @@ -57,10 +53,6 @@
find(IvlIapOtherIncomePage.has_other_income_save_btn).click
find(IvlIapOtherIncomePage.continue_btn).click

# temporary fix for content_security_policy_nonce returning nil on page load
refresh
sleep 1

find(IvlIapIncomeAdjustmentsPage.income_adjustments_yes_radiobtn).click
find(:css, IvlIapIncomeAdjustmentsPage.moving_expenses_checkbox).set(true)
fill_in IvlIapIncomeAdjustmentsPage.amount, with: '50'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@

Given(/^the user is editing an application for financial assistance$/) do
click_link(l10n('faa.nav.my_household'))
# temporary fix for content_security_policy_nonce returning nil on page load
refresh
end

When(/^the user navigates to the Tax Info page for a given applicant$/) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
sleep 2
end
click_link 'Continue'

# temporary fix for content_security_policy_nonce returning nil on page load
refresh
end

Given(/^the applicant only has one home address and one mailing address$/) do
Expand Down

0 comments on commit 1699a42

Please sign in to comment.