Skip to content

Commit cecb144

Browse files
authored
Merge pull request #2566 from alphagov/ldeb-increase-selection-options-maximum
Increase maximum number of options for selection question
2 parents 2ca282a + 9edac3c commit cecb144

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

app/input_objects/pages/selection/base_options_input.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class Pages::Selection::BaseOptionsInput < BaseInput
22
include LoggingHelper
33

44
INCLUDE_NONE_OF_THE_ABOVE_OPTIONS = %w[yes yes_with_question no].freeze
5-
MAXIMUM_CHOOSE_ONLY_ONE_OPTION = 1000
5+
MAXIMUM_CHOOSE_ONLY_ONE_OPTION = 3000
66
MAXIMUM_CHOOSE_MORE_THAN_ONE_OPTION = 30
77

88
attr_accessor :include_none_of_the_above, :draft_question

app/views/pages/selection/bulk_options.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<% if @bulk_options_input.only_one_option? %>
1414
<p><%= t("bulk_options.select_one_option") %></p>
1515
<p><%= t("bulk_options.longer_than_30_options") %></p>
16-
<p><%= t("bulk_options.up_to_1000_options") %></p>
16+
<p><%= t("bulk_options.up_to_3000_options") %></p>
1717
<% else %>
1818
<p><%= t("bulk_options.select_more_than_one_option") %></p>
1919
<p><%= t("bulk_options.up_to_30_options") %></p>

app/views/pages/selection/options.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div class="govuk-!-margin-bottom-8">
2020
<% if @selection_options_input.only_one_option? %>
2121
<p><%= t("selection_options.select_one_option") %></p>
22-
<p><%= t("selection_options.up_to_1000_options") %></p>
22+
<p><%= t("selection_options.up_to_3000_options") %></p>
2323
<% else %>
2424
<p><%= t("selection_options.select_more_than_one_option") %></p>
2525
<p><%= t("selection_options.up_to_30_options") %></p>

config/locales/en.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ en:
246246
longer_than_30_options: If your list is longer than 30 options, people will be able to search and find the options by typing into an autocomplete box.
247247
select_more_than_one_option: People will be able to select one or more options from your list.
248248
select_one_option: People will be able to select one option from your list.
249-
up_to_1000_options: You can have up to 1,000 options.
249+
up_to_3000_options: You can have up to 3,000 options.
250250
up_to_30_options: You can have up to 30 options.
251251
cancel: Cancel
252252
contact_details:
@@ -834,7 +834,7 @@ en:
834834
pages_selection_type_input:
835835
only_one_option_options:
836836
'false': Your list can have up to 30 options
837-
'true': Your list can have up to 1,000 options
837+
'true': Your list can have up to 3,000 options
838838
label:
839839
account_name_input:
840840
name: Enter your full name
@@ -1808,7 +1808,7 @@ en:
18081808
remove_html: Remove <span class="govuk-visually-hidden">option %{option_number}</span>
18091809
select_more_than_one_option: People will be able to select one or more options from your list.
18101810
select_one_option: People will be able to select one option from your list.
1811-
up_to_1000_options: You can have up to 1,000 options.
1811+
up_to_3000_options: You can have up to 3,000 options.
18121812
up_to_30_options: You can have up to 30 options.
18131813
selection_type:
18141814
reduce_your_options_warning:

config/locales/input_objects/selection/bulk_options.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ en:
77
attributes:
88
bulk_selection_options:
99
maximum_choose_more_than_one_option: You cannot have more than 30 options
10-
maximum_choose_only_one_option: You cannot have more than 1,000 options
10+
maximum_choose_only_one_option: You cannot have more than 3,000 options
1111
minimum: Enter at least 2 options
1212
uniqueness: All your options must be unique. ‘%{duplicate}’ currently appears in your list more than once.
1313
include_none_of_the_above:

config/locales/input_objects/selection/options.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ en:
1010
selection_options:
1111
blank: Add text for all of your options
1212
maximum_choose_more_than_one_option: You cannot have more than 30 options
13-
maximum_choose_only_one_option: You cannot have more than 1,000 options
13+
maximum_choose_only_one_option: You cannot have more than 3,000 options
1414
minimum: Enter at least 2 options
1515
uniqueness: All your options must be unique

spec/input_objects/pages/selection/bulk_options_input_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@
2626
context "when only_one_option is true for the draft_question" do
2727
let(:only_one_option) { "true" }
2828

29-
it "is valid if there are between 2 and 1000 unique selection values" do
29+
it "is valid if there are between 2 and 3000 unique selection values" do
3030
input.bulk_selection_options = (1..2).to_a.join("\n")
3131

3232
expect(input).to be_valid
3333
expect(input.errors.full_messages_for(:bulk_selection_options)).to be_empty
3434

35-
input.bulk_selection_options = (1..1000).to_a.join("\n")
35+
input.bulk_selection_options = (1..3000).to_a.join("\n")
3636

3737
expect(input).to be_valid
3838
expect(input.errors.full_messages_for(:bulk_selection_options)).to be_empty
3939
end
4040

41-
it "is invalid if more than 1000 Bulk selection options are provided" do
42-
input.bulk_selection_options = (1..1001).to_a.join("\n")
41+
it "is invalid if more than 3000 Bulk selection options are provided" do
42+
input.bulk_selection_options = (1..3001).to_a.join("\n")
4343
error_message = I18n.t("activemodel.errors.models.pages/selection/bulk_options_input.attributes.bulk_selection_options.maximum_choose_only_one_option")
4444
expect(input).not_to be_valid
4545

spec/input_objects/pages/selection/options_input_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@
6666
end
6767

6868
context "when only_one_option is true for the draft_question" do
69-
it "is invalid if more than 1000 selection options are provided" do
70-
input.selection_options = (1..1001).to_a.map { |i| OpenStruct.new(name: i.to_s) }
69+
it "is invalid if more than 3000 selection options are provided" do
70+
input.selection_options = (1..3001).to_a.map { |i| OpenStruct.new(name: i.to_s) }
7171
error_message = I18n.t("activemodel.errors.models.pages/selection/options_input.attributes.selection_options.maximum_choose_only_one_option")
7272
expect(input).not_to be_valid
7373

7474
expect(input.errors.full_messages_for(:selection_options)).to include("Selection options #{error_message}")
7575
end
7676

77-
it "is valid if there are 1000 unique selection values" do
78-
input.selection_options = (1..1000).to_a.map { |i| { name: i.to_s } }
77+
it "is valid if there are 3000 unique selection values" do
78+
input.selection_options = (1..3000).to_a.map { |i| { name: i.to_s } }
7979

8080
expect(input).to be_valid
8181
end

spec/support/shared_examples/pages_selection_base_options_input.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
context "when only_one_option is true" do
2424
let(:only_one_option) { "true" }
2525

26-
it { expect(input.maximum_options).to eq 1000 }
26+
it { expect(input.maximum_options).to eq 3000 }
2727
end
2828

2929
context "when only_one_option is false" do

spec/views/pages/selection/options.html.erb_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,27 @@
6060
expect(rendered).not_to have_text("You can add up to")
6161
end
6262

63-
context "when there are fewer than 1000 options" do
64-
let(:selection_options) { (1..999).to_a.map { |i| OpenStruct.new(name: i.to_s) } }
63+
context "when there are fewer than 3000 options" do
64+
let(:selection_options) { (1..2999).to_a.map { |i| OpenStruct.new(name: i.to_s) } }
6565

6666
it "has an add another button" do
6767
expect(rendered).to have_button(I18n.t("selection_options.add_another"))
6868
end
6969

7070
it "does not have inset text stating you cannot add more options" do
71-
expect(rendered).not_to have_css(".govuk-inset-text", text: "You cannot add any more options as you have reached the maximum of 1000 options.")
71+
expect(rendered).not_to have_css(".govuk-inset-text", text: "You cannot add any more options as you have reached the maximum of 3000 options.")
7272
end
7373
end
7474

75-
context "when there are 1000 options" do
76-
let(:selection_options) { (1..1000).to_a.map { |i| OpenStruct.new(name: i.to_s) } }
75+
context "when there are 3000 options" do
76+
let(:selection_options) { (1..3000).to_a.map { |i| OpenStruct.new(name: i.to_s) } }
7777

7878
it "does not have an add another button" do
7979
expect(rendered).not_to have_button(I18n.t("selection_options.add_another"))
8080
end
8181

8282
it "has inset text stating you cannot add more options" do
83-
expect(rendered).to have_css(".govuk-inset-text", text: "You cannot add any more options as you have reached the maximum of 1000 options.")
83+
expect(rendered).to have_css(".govuk-inset-text", text: "You cannot add any more options as you have reached the maximum of 3000 options.")
8484
end
8585
end
8686
end

0 commit comments

Comments
 (0)