diff --git a/app/components/candidate_interface/continuous_applications/application_review_component.html.erb b/app/components/candidate_interface/continuous_applications/application_review_component.html.erb
index 5d9d4968946..2de13b50215 100644
--- a/app/components/candidate_interface/continuous_applications/application_review_component.html.erb
+++ b/app/components/candidate_interface/continuous_applications/application_review_component.html.erb
@@ -1,6 +1,6 @@
<%= render SummaryListComponent.new(rows: rows) %>
-<% if @application_choice.personal_statement.present? %>
+<% if show_personal_statement? %>
Personal statement
diff --git a/app/components/candidate_interface/continuous_applications/application_review_component.rb b/app/components/candidate_interface/continuous_applications/application_review_component.rb
index cd650eda4c5..e812ee77ec2 100644
--- a/app/components/candidate_interface/continuous_applications/application_review_component.rb
+++ b/app/components/candidate_interface/continuous_applications/application_review_component.rb
@@ -8,6 +8,10 @@ def initialize(application_choice:)
@application_choice = application_choice
end
+ def show_personal_statement?
+ @application_choice.submitted? && @application_choice.personal_statement.present?
+ end
+
def rows
[
status_row,
diff --git a/spec/components/candidate_interface/continuous_applications/application_review_component_spec.rb b/spec/components/candidate_interface/continuous_applications/application_review_component_spec.rb
index dc2fcb28517..12abb1dd603 100644
--- a/spec/components/candidate_interface/continuous_applications/application_review_component_spec.rb
+++ b/spec/components/candidate_interface/continuous_applications/application_review_component_spec.rb
@@ -6,21 +6,26 @@
end
let(:application_choice) do
- create(:application_choice, :awaiting_provider_decision)
+ create(:application_choice, :awaiting_provider_decision, personal_statement:)
end
let(:course) { application_choice.current_course }
let(:provider) { application_choice.current_provider }
let(:links) { result.css('a').map(&:text) }
+ let(:personal_statement) { 'some personal statement' }
context 'when application is unsubmitted' do
let(:application_choice) do
- create(:application_choice, :unsubmitted)
+ create(:application_choice, :unsubmitted, personal_statement:)
end
it 'shows change course link' do
expect(links).to include("Change course for #{application_choice.current_course.name_and_code}")
end
+ it 'does not show the personal statement' do
+ expect(result.text).not_to include(personal_statement)
+ end
+
context 'when course has multiple study modes' do
before do
create(
@@ -57,6 +62,10 @@
expect(result.css('a')).to be_empty
end
+ it 'shows personal statement' do
+ expect(result.text).to include(personal_statement)
+ end
+
context 'when course has multiple study modes' do
before do
create(