Skip to content

Commit 5b1ec64

Browse files
committed
Merge pull request #2020 from alphagov/add-missing-question-option-translations-for-part-year-profit-tax-credits
Add missing question option translations for PartYearProfitTaxCreditsFlow
2 parents 5b15c03 + 138808e commit 5b1ec64

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

lib/smart_answer_flows/locales/en/part-year-profit-tax-credits.yml

+9
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ en-GB:
99
title: Have you stopped trading?
1010
hint: This means you’re no longer running your business.
1111
error_message: You need to select yes or no to continue.
12+
options:
13+
"yes": "Yes"
14+
"no": "No"
1215
did_you_start_trading_before_the_relevant_accounting_year?:
1316
title: Did you start trading before %{accounting_year_begins_on}?
1417
error_message: You need to select yes or no to continue.
18+
options:
19+
"yes": "Yes"
20+
"no": "No"
1521
when_did_you_stop_trading?:
1622
title: When did you stop trading?
1723
hint:
@@ -26,6 +32,9 @@ en-GB:
2632
do_your_accounts_cover_a_12_month_period?:
2733
title: Do your accounts cover the 12 month period up to %{accounting_year_ends_on}?
2834
error_message: You need to select yes or no to continue.
35+
options:
36+
"yes": "Yes"
37+
"no": "No"
2938
when_did_you_start_trading?:
3039
title: "When did you start trading?"
3140
hint:

test/unit/smart_answer_flows/part_year_profit_tax_credits_view_test.rb

+18
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase
4242
@presenter = QuestionPresenter.new(@i18n_prefix, question, @state)
4343
end
4444

45+
should 'have options with labels' do
46+
assert_equal({ 'yes' => 'Yes', 'no' => 'No' }, values_vs_labels(@presenter.options))
47+
end
48+
4549
should 'have a default error message' do
4650
@state.error = 'error-message'
4751
assert_equal 'You need to select yes or no to continue.', @presenter.error
@@ -55,6 +59,10 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase
5559
@presenter = QuestionPresenter.new(@i18n_prefix, question, @state)
5660
end
5761

62+
should 'have options with labels' do
63+
assert_equal({ 'yes' => 'Yes', 'no' => 'No' }, values_vs_labels(@presenter.options))
64+
end
65+
5866
should 'have a default error message' do
5967
@state.error = 'error-message'
6068
assert_equal 'You need to select yes or no to continue.', @presenter.error
@@ -74,6 +82,10 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase
7482
assert_equal expected, @presenter.title
7583
end
7684

85+
should 'have options with labels' do
86+
assert_equal({ 'yes' => 'Yes', 'no' => 'No' }, values_vs_labels(@presenter.options))
87+
end
88+
7789
should 'have a default error message' do
7890
@state.error = 'error-message'
7991
assert_equal 'You need to select yes or no to continue.', @presenter.error
@@ -219,5 +231,11 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase
219231
end
220232
end
221233
end
234+
235+
private
236+
237+
def values_vs_labels(options)
238+
options.inject({}) { |h, o| h[o.value] = o.label; h }
239+
end
222240
end
223241
end

0 commit comments

Comments
 (0)