From ac6f858b7e389284d6d3e72e474152b98109e496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Avelino?= Date: Thu, 20 Jul 2017 17:44:34 -0300 Subject: [PATCH] Added missing button/collapse bootstrap js --- app/assets/javascripts/main.js | 2 + spec/features/admin/registries_spec.rb | 52 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 5ca060905..1805e4863 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -7,6 +7,8 @@ import 'bootstrap/js/tab'; import 'bootstrap/js/tooltip'; import 'bootstrap/js/popover'; import 'bootstrap/js/dropdown'; +import 'bootstrap/js/button'; +import 'bootstrap/js/collapse'; // Life it up import 'vendor/lifeitup_layout'; diff --git a/spec/features/admin/registries_spec.rb b/spec/features/admin/registries_spec.rb index f5230e0d5..7a53793e9 100644 --- a/spec/features/admin/registries_spec.rb +++ b/spec/features/admin/registries_spec.rb @@ -37,6 +37,34 @@ expect(page).to have_content("Registry was successfully created.") expect(Registry.any?).to be_truthy end + + it "shows advanced options when clicking on Show Advanced", js: true do + visit new_admin_registry_path + + expect(page).not_to have_css("#advanced.collapse.in") + + click_button "Show Advanced" + wait_for_effect_on("#advanced") + + expect(page).to have_content("External Registry Name") + expect(page).to have_css("#advanced.collapse.in") + end + + it "hides advanced options when clicking on Hide Advanced", js: true do + visit new_admin_registry_path + + click_button "Show Advanced" + wait_for_effect_on("#advanced") + + expect(page).to have_content("External Registry Name") + expect(page).to have_css("#advanced.collapse.in") + + click_button "Hide Advanced" + wait_for_effect_on("#advanced") + + expect(page).not_to have_css("#advanced.collapse.in") + expect(page).not_to have_content("External Registry Name") + end end describe "update" do @@ -64,5 +92,29 @@ registry.reload expect(registry.hostname).to eq "lala" end + + it "shows advanced options when clicking on Show Advanced", js: true do + expect(page).not_to have_css("#advanced") + + click_button "Show Advanced" + wait_for_effect_on("#advanced") + + expect(page).to have_content("External Registry Name") + expect(page).to have_css("#advanced.collapse.in") + end + + it "hides advanced options when clicking on Hide Advanced", js: true do + click_button "Show Advanced" + wait_for_effect_on("#advanced") + + expect(page).to have_content("External Registry Name") + expect(page).to have_css("#advanced.collapse.in") + + click_button "Hide Advanced" + wait_for_effect_on("#advanced") + + expect(page).not_to have_css("#advanced.collapse.in") + expect(page).not_to have_content("External Registry Name") + end end end