fix(dossier/footer): don't say user can submit dossier when he can't
This commit is contained in:
parent
0a406376cb
commit
a54f022353
4 changed files with 50 additions and 2 deletions
|
@ -5,7 +5,8 @@ en:
|
|||
confirmation: Draft saved
|
||||
error: Impossible to save the draft
|
||||
en_construction:
|
||||
explanation: Your modifications are automatically saved. Submit them when you’re done.
|
||||
explanation: Your modifications are automatically saved.
|
||||
submit_them: Submit them when you’re done.
|
||||
confirmation: Modifications saved
|
||||
error: Impossible to save the modifications.
|
||||
annotations:
|
||||
|
|
|
@ -5,7 +5,8 @@ fr:
|
|||
confirmation: Brouillon enregistré
|
||||
error: Impossible d’enregistrer le brouillon
|
||||
en_construction:
|
||||
explanation: Vos modifications sont automatiquement enregistrées. Déposez-les quand vous aurez terminé.
|
||||
explanation: Vos modifications sont automatiquement enregistrées.
|
||||
submit_them: Déposez-les quand vous aurez terminé.
|
||||
confirmation: Modifications enregistrées.
|
||||
error: Impossible d’enregistrer les modifications
|
||||
annotations:
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
= t('.annotations.explanation')
|
||||
- elsif dossier.editing_fork?
|
||||
= t('.en_construction.explanation')
|
||||
- if dossier.can_passer_en_construction?
|
||||
= t('.en_construction.submit_them')
|
||||
- else
|
||||
= t('.brouillon.explanation')
|
||||
- if !annotation?
|
||||
|
|
44
spec/components/dossiers/autosave_footer_component_spec.rb
Normal file
44
spec/components/dossiers/autosave_footer_component_spec.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Dossiers::AutosaveFooterComponent, type: :component do
|
||||
subject(:component) { render_inline(described_class.new(dossier:, annotation:)) }
|
||||
|
||||
let(:dossier) { create(:dossier) }
|
||||
let(:annotation) { false }
|
||||
|
||||
context 'when showing brouillon state (default state)' do
|
||||
it 'displays brouillon explanation' do
|
||||
expect(component).to have_text("Votre brouillon")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when editing fork and can pass en construction' do
|
||||
let(:dossier) { create(:dossier, :en_construction).find_or_create_editing_fork(create(:user)) }
|
||||
|
||||
it 'displays en construction explanation' do
|
||||
expect(component).to have_text("Vos modifications")
|
||||
expect(component).to have_text("Déposez-les")
|
||||
end
|
||||
|
||||
context 'when dossier is not eligible' do
|
||||
before do
|
||||
allow(dossier).to receive(:can_passer_en_construction?).and_return(false)
|
||||
end
|
||||
|
||||
it 'displays en construction explanation' do
|
||||
expect(component).to have_text("Vos modifications")
|
||||
expect(component).not_to have_text("Déposez-les")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when showing annotations' do
|
||||
let(:annotation) { true }
|
||||
|
||||
it 'displays annotations explanation' do
|
||||
expect(component).to have_text("Vos annotations")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue