dossiers: add an empty state

This commit is contained in:
Pierre de La Morinerie 2018-06-25 13:14:22 +00:00
parent 06de1d6cee
commit 8c36c8d26f
2 changed files with 44 additions and 28 deletions

View file

@ -14,6 +14,7 @@
dossiers invités
.container
- if @dossiers.present?
%table.table.dossiers-table.hoverable
%thead
%tr
@ -40,5 +41,7 @@
%td.updated-at-col
= link_to(users_dossier_recapitulatif_path(dossier), class: 'cell-link') do
= dossier.updated_at.localtime.strftime("%d/%m/%Y")
= paginate(@dossiers)
- else
%h2.empty-text Aucun dossier.

View file

@ -25,6 +25,19 @@ describe 'new_user/dossiers/index.html.haml', type: :view do
expect(rendered).to have_link(dossier.id, href: users_dossier_recapitulatif_path(dossier))
end
context 'quand il ny a aucun dossier' do
let(:user_dossiers) { [] }
let(:dossiers_invites) { [] }
it 'naffiche pas la table' do
expect(rendered).not_to have_selector('.dossiers-table')
end
it 'affiche un message' do
expect(rendered).to have_text('Aucun dossier')
end
end
context 'quand il ny a pas de dossiers invités' do
let(:dossiers_invites) { [] }
@ -37,7 +50,7 @@ describe 'new_user/dossiers/index.html.haml', type: :view do
end
end
context 'avec des dossiers invités' do
context 'quand il y a des dossiers invités' do
let(:dossiers_invites) { create_list(:dossier, 1) }
it 'affiche un titre adapté' do