From fdd4f8f5d583bb249affbccb2265d74e776f7713 Mon Sep 17 00:00:00 2001 From: Wabo Date: Tue, 2 Jun 2026 22:52:54 -0400 Subject: [PATCH] Fix SMS JS dropdown, enable toggle, landing page link text, add SMS tests - Fix SMS provider dropdown: switch from nonce'd javascript_tag to inline onchange handler (Turbo-compatible) - Fix enable toggle: handle serialized JSON string values ("true"/"1") in addition to boolean true - Fix landing page: change link text from github.com/docusealco to github.com/wabolabs/wabosign - Add comprehensive SMS system tests (4 examples) covering provider form rendering, toggle, enabled state, and test message section --- app/views/pages/landing.html.erb | 2 +- app/views/sms_settings/index.html.erb | 20 +++--------------- spec/system/sms_settings_spec.rb | 30 ++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/app/views/pages/landing.html.erb b/app/views/pages/landing.html.erb index 4f20ea0f..df588d24 100644 --- a/app/views/pages/landing.html.erb +++ b/app/views/pages/landing.html.erb @@ -67,7 +67,7 @@

Open Source

- Source code is available under github.com/docusealco.
+ Source code is available under github.com/wabolabs/wabosign.
Open-source contributors are always ready to help!

diff --git a/app/views/sms_settings/index.html.erb b/app/views/sms_settings/index.html.erb index e41ad9b2..0b3b5907 100644 --- a/app/views/sms_settings/index.html.erb +++ b/app/views/sms_settings/index.html.erb @@ -54,7 +54,7 @@
@@ -63,7 +63,8 @@ Sms::SUPPORTED_PROVIDERS.map { |p| [provider_labels[p] || p, p] }, { selected: selected_provider }, class: 'base-select', - id: 'sms_provider_select' %> + id: 'sms_provider_select', + onchange: 'var s=this,v=s.value;document.querySelectorAll("[data-provider-block]").forEach(function(b){b.classList.toggle("hidden",b.dataset.providerBlock!==v)})' %>
@@ -185,18 +186,3 @@
-<%= javascript_tag nonce: true do %> - (function () { - const select = document.getElementById('sms_provider_select') - if (!select) return - const blocks = document.querySelectorAll('[data-provider-block]') - const sync = () => { - const current = select.value - blocks.forEach((block) => { - block.classList.toggle('hidden', block.dataset.providerBlock !== current) - }) - } - select.addEventListener('change', sync) - sync() - })() -<% end %> diff --git a/spec/system/sms_settings_spec.rb b/spec/system/sms_settings_spec.rb index 648346ff..12fdb434 100644 --- a/spec/system/sms_settings_spec.rb +++ b/spec/system/sms_settings_spec.rb @@ -8,10 +8,38 @@ RSpec.describe 'SMS Settings' do sign_in(user) end - it 'shows the SMS settings page with provider form' do + it 'shows the SMS settings page with provider form and all provider blocks' do visit settings_sms_path expect(page).to have_content('SMS') expect(page).to have_content('Provider') + + expect(page).to have_content('BulkVS Basic Auth Token') + end + + it 'renders the enable toggle and provider select' do + visit settings_sms_path + + expect(page).to have_css("input[type='checkbox'].toggle") + expect(page).to have_css('select.base-select') + end + + it 'shows the save button' do + visit settings_sms_path + + expect(page).to have_button('Save') + end + + it 'shows the test SMS section when SMS is configured and enabled' do + create(:encrypted_config, account:, key: EncryptedConfig::SMS_CONFIGS_KEY, + value: { 'enabled' => true, 'provider' => 'twilio', + 'twilio_account_sid' => 'AC123', + 'twilio_auth_token' => 'token', + 'twilio_from' => '+15551234567' }) + + visit settings_sms_path + + expect(page).to have_content('SMS is enabled') + expect(page).to have_content('Send a test SMS') end end