Merge pull request #10603 from demarches-simplifiees/bug-input-pj-apres-suppression
ETQ Admin (bug), je veux pouvoir modifier des PJ sans recharger la page
This commit is contained in:
commit
90e6c8a6f6
9 changed files with 41 additions and 23 deletions
|
@ -23,7 +23,7 @@ RSpec.describe Attachment::EditComponent, type: :component do
|
|||
let(:attachment) { nil }
|
||||
|
||||
it 'renders a form field for uploading a file' do
|
||||
expect(subject).to have_selector('input[type=file]:not(.hidden)')
|
||||
expect(subject).to have_selector('input[type=file]:not([disabled])')
|
||||
end
|
||||
|
||||
it 'renders max size' do
|
||||
|
@ -40,8 +40,8 @@ RSpec.describe Attachment::EditComponent, type: :component do
|
|||
expect(subject).to have_content(attachment.filename.to_s)
|
||||
end
|
||||
|
||||
it 'hides the file field by default' do
|
||||
expect(subject).to have_selector('input[type=file].hidden')
|
||||
it 'disabled the file field by default' do
|
||||
expect(subject).to have_selector('input[type=file][disabled]')
|
||||
end
|
||||
|
||||
it 'shows the Delete button by default' do
|
||||
|
|
|
@ -50,7 +50,7 @@ describe AttachmentsController, type: :controller do
|
|||
let(:signed_id) { attachment.blob.signed_id }
|
||||
|
||||
subject do
|
||||
delete :destroy, params: { id: attachment.id, signed_id: signed_id }, format: :turbo_stream
|
||||
delete :destroy, params: { id: attachment.id, signed_id: signed_id, dossier_id: dossier.id, stable_id: champ.stable_id }, format: :turbo_stream
|
||||
end
|
||||
|
||||
context "when authenticated" do
|
||||
|
|
|
@ -30,6 +30,7 @@ describe "Dossier en_construction" do
|
|||
visit_dossier(dossier)
|
||||
|
||||
click_on "Supprimer le fichier toto.txt"
|
||||
expect(page).not_to have_text("toto.txt")
|
||||
|
||||
input_selector = "#attachment-multiple-empty-#{champ.public_id}"
|
||||
expect(page).to have_selector(input_selector)
|
||||
|
@ -37,7 +38,6 @@ describe "Dossier en_construction" do
|
|||
|
||||
wait_until { champ.reload.for_export == 'file.pdf' }
|
||||
expect(page).to have_text("file.pdf")
|
||||
expect(page).not_to have_text("toto.txt")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,13 +54,13 @@ describe "Dossier en_construction" do
|
|||
visit_dossier(dossier)
|
||||
|
||||
click_on "Supprimer le fichier toto.png"
|
||||
expect(page).not_to have_text("toto.png")
|
||||
|
||||
input_selector = "##{champ.input_id}"
|
||||
expect(page).to have_selector(input_selector)
|
||||
find(input_selector).attach_file(Rails.root.join('spec/fixtures/files/file.pdf'))
|
||||
|
||||
expect(page).to have_text("file.pdf")
|
||||
expect(page).not_to have_text("toto.png")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue