diff options
| author | Robert | 2017-12-07 08:08:11 +0100 |
|---|---|---|
| committer | Robert | 2017-12-07 20:53:43 +0100 |
| commit | b07c6d9c198c9417981a143b04698ff52db91024 (patch) | |
| tree | c7a900c4dc0f663b04c74548a15296773bd88c25 | |
| parent | 0bb71d8146126f4f2c53ca0c7145f0e7d5eaeda5 (diff) | |
| download | chouette-core-b07c6d9c198c9417981a143b04698ff52db91024.tar.bz2 | |
Refs: #5198@1.5h; Specing the presence of the Modal Action Box
- verifying the visibility of the action box
- no dynamic behavior of the action box is verified (yet?) - would need javascript execution
- refactoring suggestions --> https://projects.af83.io/issues/5206
| -rw-r--r-- | app/helpers/multiple_selection_toolbox_helper.rb | 11 | ||||
| -rw-r--r-- | app/views/workbenches/show.html.slim | 2 | ||||
| -rw-r--r-- | spec/features/routes_permissions_spec.rb | 3 | ||||
| -rw-r--r-- | spec/features/workbenches/workbenches_permissions_spec.rb (renamed from spec/features/workbenches_permissions_spec.rb) | 0 | ||||
| -rw-r--r-- | spec/features/workbenches/workbenches_show_modal_actions_spec.rb | 29 | ||||
| -rw-r--r-- | spec/features/workbenches/workbenches_show_spec.rb (renamed from spec/features/workbenches_spec.rb) | 0 |
6 files changed, 39 insertions, 6 deletions
diff --git a/app/helpers/multiple_selection_toolbox_helper.rb b/app/helpers/multiple_selection_toolbox_helper.rb index 85294af6d..e0a1d2dd4 100644 --- a/app/helpers/multiple_selection_toolbox_helper.rb +++ b/app/helpers/multiple_selection_toolbox_helper.rb @@ -1,7 +1,11 @@ module MultipleSelectionToolboxHelper # Box of links that floats at the bottom right of the page - def multiple_selection_toolbox(actions) + # c.f. https://projects.af83.io/issues/5206 + # #5206 method too long + def multiple_selection_toolbox(actions, collection_name:) links = content_tag :ul do + + # #5206 `if params[:controller]` mieux passer comme parametre si besoin delete_path = nil if params[:controller] = 'workbenches' @@ -15,6 +19,7 @@ module MultipleSelectionToolboxHelper method: :delete, data: { path: delete_path, + # #5206 Missing Translations confirm: 'Etes-vous sûr(e) de vouloir effectuer cette action ?' }, title: t("actions.#{action}") @@ -33,7 +38,9 @@ module MultipleSelectionToolboxHelper class: 'info-msg' ) - content_tag :div, '', class: 'select_toolbox noselect' do + content_tag :div, '', + class: 'select_toolbox noselect', + id: "selected-#{collection_name}-action-box" do links + label end end diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index 22869b2d7..af312fc08 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -61,7 +61,7 @@ links: [:show, :edit], cls: 'table has-filter has-search' - = multiple_selection_toolbox([:delete]) + = multiple_selection_toolbox([:delete], collection_name: 'referentials') = new_pagination @wbench_refs, 'pull-right' diff --git a/spec/features/routes_permissions_spec.rb b/spec/features/routes_permissions_spec.rb index 36c13b24a..6d3db9d55 100644 --- a/spec/features/routes_permissions_spec.rb +++ b/spec/features/routes_permissions_spec.rb @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -require 'spec_helper' - describe "Routes", :type => :feature do login_user diff --git a/spec/features/workbenches_permissions_spec.rb b/spec/features/workbenches/workbenches_permissions_spec.rb index d58293538..d58293538 100644 --- a/spec/features/workbenches_permissions_spec.rb +++ b/spec/features/workbenches/workbenches_permissions_spec.rb diff --git a/spec/features/workbenches/workbenches_show_modal_actions_spec.rb b/spec/features/workbenches/workbenches_show_modal_actions_spec.rb new file mode 100644 index 000000000..ebc48b485 --- /dev/null +++ b/spec/features/workbenches/workbenches_show_modal_actions_spec.rb @@ -0,0 +1,29 @@ +RSpec.describe 'Workbenches', type: :feature do + login_user + + let(:line_ref) { create :line_referential } + let(:line) { create :line, line_referential: line_ref } + let(:ref_metadata) { create(:referential_metadata, lines: [line]) } + + let(:workbench) { create :workbench, line_referential: line_ref, organisation: @user.organisation } + let!(:referential) { create :workbench_referential, + workbench: workbench, + metadatas: [ref_metadata], + organisation: @user.organisation } + + + describe 'show' do + context 'modal action' do + it 'expected behavior' do + visit workbench_path(workbench) + + # Modal Action Box: is present + within( :css, ".select_toolbox#selected-referentials-action-box span.info-msg > span") do + expect( page ).to have_content("0") + end + + end + end + end + +end diff --git a/spec/features/workbenches_spec.rb b/spec/features/workbenches/workbenches_show_spec.rb index f1151a67b..f1151a67b 100644 --- a/spec/features/workbenches_spec.rb +++ b/spec/features/workbenches/workbenches_show_spec.rb |
