clean(spec): rubocopify / fix specs
This commit is contained in:
parent
0563ac391b
commit
6556fda218
8 changed files with 29 additions and 17 deletions
|
@ -1,19 +1,19 @@
|
||||||
.fr-mb-5v
|
.fr-mb-5v
|
||||||
- if @batch.finished_and_success? && @batch.seen_at.nil?
|
- if @batch.finished_and_success? && @batch.seen_at.nil?
|
||||||
= render Dsfr::AlertComponent.new(title: t('.finish.title'), state: :success) do |c|
|
= render Dsfr::AlertComponent.new(title: t('.finish.title'), state: :success, heading_level: 'h2') do |c|
|
||||||
- c.body do
|
- c.body do
|
||||||
%p
|
%p
|
||||||
= t('.finish.text_success', count: @batch.success_dossier_ids.count)
|
= t('.finish.text_success', count: @batch.success_dossier_ids.count)
|
||||||
- set_seen_at!
|
- set_seen_at!
|
||||||
|
|
||||||
- if @batch.finished_and_fails? && @batch.seen_at.nil?
|
- if @batch.finished_and_fails? && @batch.seen_at.nil?
|
||||||
= render Dsfr::AlertComponent.new(title: t('.finish.title'), state: :warning) do |c|
|
= render Dsfr::AlertComponent.new(title: t('.finish.title'), state: :warning, heading_level: 'h2') do |c|
|
||||||
- c.body do
|
- c.body do
|
||||||
%p
|
%p
|
||||||
= t('.finish.text_fail', count: @batch.failed_dossier_ids.count)
|
= t('.finish.text_fail', count: @batch.failed_dossier_ids.count)
|
||||||
- set_seen_at!
|
- set_seen_at!
|
||||||
- if @batch.beginning?
|
- if @batch.beginning?
|
||||||
= render Dsfr::AlertComponent.new(title: t('.in_progress.title'), state: :info) do |c|
|
= render Dsfr::AlertComponent.new(title: t('.in_progress.title'), state: :info, heading_level: 'h2') do |c|
|
||||||
- c.body do
|
- c.body do
|
||||||
%p
|
%p
|
||||||
= t('.in_progress.text_beginning', count: @batch.dossiers.count)
|
= t('.in_progress.text_beginning', count: @batch.dossiers.count)
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
= t('.after_link_text')
|
= t('.after_link_text')
|
||||||
|
|
||||||
- if @batch.in_progress?
|
- if @batch.in_progress?
|
||||||
= render Dsfr::AlertComponent.new(title: t('.in_progress.title'), state: :info) do |c|
|
= render Dsfr::AlertComponent.new(title: t('.in_progress.title'), state: :info, heading_level: 'h2') do |c|
|
||||||
- c.body do
|
- c.body do
|
||||||
|
|
||||||
- if @batch.failed_dossier_ids.present?
|
- if @batch.failed_dossier_ids.present?
|
||||||
|
|
|
@ -14,11 +14,12 @@ class Dsfr::AlertComponent < ApplicationComponent
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def initialize(state:, title:)
|
def initialize(state:, title:, heading_level: 'h3')
|
||||||
@state = state
|
@state = state
|
||||||
@title = title
|
@title = title
|
||||||
@block = block
|
@block = block
|
||||||
|
@heading_level = heading_level
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :state, :title, :block
|
attr_reader :state, :title, :block, :heading_level
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
= link_to restore_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: "fr-btn fr-btn--secondary" do
|
= link_to restore_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: "fr-btn fr-btn--secondary" do
|
||||||
= t('views.instructeurs.dossiers.restore')
|
= t('views.instructeurs.dossiers.restore')
|
||||||
- elsif close_to_expiration || Dossier::TERMINE.include?(state)
|
- elsif close_to_expiration || Dossier::TERMINE.include?(state)
|
||||||
.dropdown.user-dossier-actions{ data: { controller: 'menu-button' } }
|
%li.dropdown.user-dossier-actions{ data: { controller: 'menu-button' } }
|
||||||
%button.fr-btn.fr-mb-0.dropdown-button{ data: { menu_button_target: 'button' } }
|
%button.fr-btn.fr-mb-0.dropdown-button{ data: { menu_button_target: 'button' } }
|
||||||
Actions
|
Actions
|
||||||
.dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' }, id: "dossier_#{dossier_id}_actions_menu" }
|
.dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' }, id: "dossier_#{dossier_id}_actions_menu" }
|
||||||
|
@ -11,23 +11,23 @@
|
||||||
%li
|
%li
|
||||||
= link_to repousser_expiration_instructeur_dossier_path(procedure_id, dossier_id), method: :post do
|
= link_to repousser_expiration_instructeur_dossier_path(procedure_id, dossier_id), method: :post do
|
||||||
%span.icon.standby
|
%span.icon.standby
|
||||||
.dropdown-description= t('instructeurs.dossiers.header.banner.button_delay_expiration')
|
%span.dropdown-description= t('instructeurs.dossiers.header.banner.button_delay_expiration')
|
||||||
- if archived
|
- if archived
|
||||||
%li
|
%li
|
||||||
= link_to unarchive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch do
|
= link_to unarchive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch do
|
||||||
%span.icon.unarchive
|
%span.icon.unarchive
|
||||||
.dropdown-description
|
%span.dropdown-description
|
||||||
Désarchiver le dossier
|
Désarchiver le dossier
|
||||||
- else
|
- else
|
||||||
%li
|
%li
|
||||||
= link_to archive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch do
|
= link_to archive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch do
|
||||||
%span.icon.archive
|
%span.icon.archive
|
||||||
.dropdown-description
|
%span.dropdown-description
|
||||||
Archiver le dossier
|
Archiver le dossier
|
||||||
%li.danger
|
%li.danger
|
||||||
= link_to instructeur_dossier_path(procedure_id, dossier_id), method: :delete do
|
= link_to instructeur_dossier_path(procedure_id, dossier_id), method: :delete do
|
||||||
%span.icon.delete
|
%span.icon.delete
|
||||||
.dropdown-description
|
%span.dropdown-description
|
||||||
= t('views.instructeurs.dossiers.delete_dossier')
|
= t('views.instructeurs.dossiers.delete_dossier')
|
||||||
|
|
||||||
- elsif Dossier::EN_CONSTRUCTION_OU_INSTRUCTION.include?(state)
|
- elsif Dossier::EN_CONSTRUCTION_OU_INSTRUCTION.include?(state)
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
%tr
|
%tr
|
||||||
- if batch_operation_component.render?
|
- if batch_operation_component.render?
|
||||||
%th.text-center
|
%th.text-center
|
||||||
%input{ type: "checkbox", data: { "batch-operation-target" => "all","action" => "batch-operation#onCheckAll"}, id: dom_id(BatchOperation.new, :checkbox_all), aria: { title: t('views.instructeurs.dossiers.select_all') } }
|
%input{ type: "checkbox", data: { "batch-operation-target" => "all","action" => "batch-operation#onCheckAll"}, id: dom_id(BatchOperation.new, :checkbox_all), aria: { label: t('views.instructeurs.dossiers.select_all') } }
|
||||||
- else
|
- else
|
||||||
- if @statut.in? %w(suivis traites tous)
|
- if @statut.in? %w(suivis traites tous)
|
||||||
= render partial: "header_field", locals: { field: { "label" => "●", "table" => "notifications", "column" => "notifications" }, classname: "notification-col text-center" }
|
= render partial: "header_field", locals: { field: { "label" => "●", "table" => "notifications", "column" => "notifications" }, classname: "notification-col text-center" }
|
||||||
|
@ -120,9 +120,9 @@
|
||||||
%td.text-center
|
%td.text-center
|
||||||
- if batch_operation_component.render?
|
- if batch_operation_component.render?
|
||||||
- if p.batch_operation_id.present?
|
- if p.batch_operation_id.present?
|
||||||
= check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, true, disabled: true, id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}")
|
= check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, true, disabled: true, id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: {label: t('views.instructeurs.dossiers.batch_operation.disabled')}
|
||||||
- else
|
- else
|
||||||
= check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, false, data: { "batch-operation-target" => "input", "action" => "batch-operation#onCheckOne"}, form: dom_id(BatchOperation.new), id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}")
|
= check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, false, data: { "batch-operation-target" => "input", "action" => "batch-operation#onCheckOne"}, form: dom_id(BatchOperation.new), id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: {label: t('views.instructeurs.dossiers.batch_operation.enabled')}
|
||||||
- else
|
- else
|
||||||
- if p.hidden_by_administration_at.present?
|
- if p.hidden_by_administration_at.present?
|
||||||
%span.cell-link
|
%span.cell-link
|
||||||
|
|
|
@ -177,6 +177,9 @@ en:
|
||||||
filters:
|
filters:
|
||||||
title: Filter
|
title: Filter
|
||||||
select_all: Select all
|
select_all: Select all
|
||||||
|
batch_operation:
|
||||||
|
enabled: "Add this file to the selection for the bulk operation"
|
||||||
|
disabled: "Impossible to add this file to the selection because it is already in a bulk operation"
|
||||||
personalize: Personalize
|
personalize: Personalize
|
||||||
follow_file: Follow-up the file
|
follow_file: Follow-up the file
|
||||||
save: Save
|
save: Save
|
||||||
|
|
|
@ -172,6 +172,9 @@ fr:
|
||||||
filters:
|
filters:
|
||||||
title: Filtrer
|
title: Filtrer
|
||||||
select_all: Tout selectionner
|
select_all: Tout selectionner
|
||||||
|
batch_operation:
|
||||||
|
enabled: "Ajouter ce dossier à la selection pour un traitement de masse"
|
||||||
|
disabled: "Impossible d'ajouter ce dossier à la selection car il est déjà dans un traitement de masse"
|
||||||
personalize: Personnaliser
|
personalize: Personnaliser
|
||||||
download: Télécharger un dossier
|
download: Télécharger un dossier
|
||||||
follow_file: Suivre le dossier
|
follow_file: Suivre le dossier
|
||||||
|
|
|
@ -343,9 +343,9 @@ describe Instructeurs::ProceduresController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with batch operations' do
|
context 'with batch operations' do
|
||||||
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier], instructeur: instructeur) }
|
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier], instructeur: instructeur, groupe_instructeurs: instructeur.groupe_instructeurs) }
|
||||||
let!(:termine_dossier_2) { create(:dossier, :accepte, procedure: procedure) }
|
let!(:termine_dossier_2) { create(:dossier, :accepte, procedure: procedure) }
|
||||||
let!(:batch_operation_2) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier_2], instructeur: instructeur) }
|
let!(:batch_operation_2) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier_2], instructeur: instructeur, groupe_instructeurs: instructeur.groupe_instructeurs) }
|
||||||
|
|
||||||
before { subject }
|
before { subject }
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ describe Instructeurs::ProceduresController, type: :controller do
|
||||||
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier], instructeur: instructeur_2) }
|
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier], instructeur: instructeur_2) }
|
||||||
before { subject }
|
before { subject }
|
||||||
|
|
||||||
it { expect(assigns(:batch_operations)).to eq(nil) }
|
it { expect(assigns(:batch_operations)).to eq([]) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,9 @@ describe 'BatchOperation a dossier:', js: true do
|
||||||
dossier_3 = create(:dossier, :accepte, procedure: procedure)
|
dossier_3 = create(:dossier, :accepte, procedure: procedure)
|
||||||
log_in(instructeur.email, password)
|
log_in(instructeur.email, password)
|
||||||
visit instructeur_procedure_path(procedure, statut: 'traites')
|
visit instructeur_procedure_path(procedure, statut: 'traites')
|
||||||
|
|
||||||
|
# check a11y with enabled checkbox
|
||||||
|
expect(page).to be_axe_clean
|
||||||
# ensure button is disabled by default
|
# ensure button is disabled by default
|
||||||
expect(page).to have_selector('input[disabled][value="Archiver la sélection"]')
|
expect(page).to have_selector('input[disabled][value="Archiver la sélection"]')
|
||||||
|
|
||||||
|
@ -28,6 +31,8 @@ describe 'BatchOperation a dossier:', js: true do
|
||||||
|
|
||||||
# ensure batched dossier is disabled
|
# ensure batched dossier is disabled
|
||||||
expect(page).to have_selector("##{checkbox_id}[disabled]")
|
expect(page).to have_selector("##{checkbox_id}[disabled]")
|
||||||
|
# check a11y with disabled checkbox
|
||||||
|
expect(page).to be_axe_clean
|
||||||
|
|
||||||
# ensure alert is present
|
# ensure alert is present
|
||||||
expect(page).to have_content("Information : Une action de masse est en cours")
|
expect(page).to have_content("Information : Une action de masse est en cours")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue