Unify expectations on spec components folder

In this PR (https://github.com/consul/consul/pull/4683) a new syntax was introduced
in the component specs to check that the component was not rendering.
It seems interesting to add this syntax to the rest of the cases and thus unify the way
we check that a component is not rendering.
This commit is contained in:
taitus
2021-11-03 11:56:36 +01:00
parent 21170d0f24
commit 2b35144540
15 changed files with 22 additions and 27 deletions

View File

@@ -49,7 +49,7 @@ describe Admin::Budgets::DurationComponent do
render Admin::Budgets::DurationComponent.new(durable).duration render Admin::Budgets::DurationComponent.new(durable).duration
expect(page.text).to be_empty expect(page.native.inner_html).to be_empty
end end
it "is not defined when no start date is defined" do it "is not defined when no start date is defined" do
@@ -57,7 +57,7 @@ describe Admin::Budgets::DurationComponent do
render Admin::Budgets::DurationComponent.new(durable).duration render Admin::Budgets::DurationComponent.new(durable).duration
expect(page.text).to be_empty expect(page.native.inner_html).to be_empty
end end
end end

View File

@@ -6,8 +6,7 @@ describe Admin::BudgetsWizard::Headings::GroupSwitcherComponent do
render_inline Admin::BudgetsWizard::Headings::GroupSwitcherComponent.new(group) render_inline Admin::BudgetsWizard::Headings::GroupSwitcherComponent.new(group)
expect(page.text).to be_empty expect(page.native.inner_html).to be_empty
expect(page).not_to have_css ".budget-group-switcher"
end end
it "renders a link to switch group for budgets with two groups" do it "renders a link to switch group for budgets with two groups" do

View File

@@ -28,8 +28,7 @@ describe Budgets::SupportsInfoComponent do
render_inline component render_inline component
expect(page).not_to have_selector ".supports-info" expect(page.native.inner_html).to be_empty
expect(page.text).to be_empty
end end
describe "#total_supports" do describe "#total_supports" do

View File

@@ -13,8 +13,7 @@ describe Layout::LocaleSwitcherComponent do
it "doesn't render anything" do it "doesn't render anything" do
render_inline component render_inline component
expect(page.text).to be_empty expect(page.native.inner_html).to be_empty
expect(page).not_to have_css ".locale"
end end
end end

View File

@@ -33,7 +33,7 @@ describe Layout::SocialComponent do
render_inline Layout::SocialComponent.new render_inline Layout::SocialComponent.new
expect(page).not_to have_css "ul" expect(page.native.inner_html).to be_empty
end end
end end
end end

View File

@@ -13,7 +13,7 @@ describe Layout::TopLinksComponent do
it "does not render when no content block is defined" do it "does not render when no content block is defined" do
render_inline Layout::TopLinksComponent.new render_inline Layout::TopLinksComponent.new
expect(page).not_to have_css "ul" expect(page.native.inner_html).to be_empty
end end
end end
end end

View File

@@ -13,7 +13,7 @@ describe SDG::Goals::HelpPageComponent do
render_inline component render_inline component
expect(page).not_to have_css ".sdg-help-content" expect(page.native.inner_html).to be_empty
end end
it "renders content when the feature is enabled" do it "renders content when the feature is enabled" do

View File

@@ -14,7 +14,7 @@ describe SDG::Goals::PlainTagListComponent do
render_inline component render_inline component
expect(page).not_to have_css "li" expect(page.native.inner_html).to be_empty
end end
it "does not render when the SDG process feature is disabled" do it "does not render when the SDG process feature is disabled" do

View File

@@ -14,7 +14,7 @@ describe SDG::Goals::TagListComponent do
render_inline component render_inline component
expect(page).not_to have_css "li" expect(page.native.inner_html).to be_empty
end end
it "does not render when the SDG process feature is disabled" do it "does not render when the SDG process feature is disabled" do
@@ -22,7 +22,7 @@ describe SDG::Goals::TagListComponent do
render_inline component render_inline component
expect(page).not_to have_css "li" expect(page.native.inner_html).to be_empty
end end
it "renders a list of goals" do it "renders a list of goals" do

View File

@@ -13,9 +13,7 @@ describe SDG::Goals::TargetsComponent do
render_inline component render_inline component
expect(page).not_to have_css ".targets" expect(page.native.inner_html).to be_empty
expect(page).not_to have_css "#target_tabs"
expect(page).not_to have_css ".tabs-content"
end end
it "renders tabs panel" do it "renders tabs panel" do

View File

@@ -15,7 +15,7 @@ describe SDG::RelatedListSelectorComponent do
render_inline component render_inline component
expect(page).not_to have_css ".sdg-related-list-selector" expect(page.native.inner_html).to be_empty
end end
it "does not render when the SDG process feature is disabled" do it "does not render when the SDG process feature is disabled" do
@@ -23,7 +23,7 @@ describe SDG::RelatedListSelectorComponent do
render_inline component render_inline component
expect(page).not_to have_css ".sdg-related-list-selector" expect(page.native.inner_html).to be_empty
end end
it "renders related_sdg_list field" do it "renders related_sdg_list field" do

View File

@@ -18,7 +18,7 @@ describe SDG::Targets::PlainTagListComponent do
render_inline component render_inline component
expect(page).not_to have_css "li" expect(page.native.inner_html).to be_empty
end end
it "does not render when the SDG process feature is disabled" do it "does not render when the SDG process feature is disabled" do
@@ -26,7 +26,7 @@ describe SDG::Targets::PlainTagListComponent do
render_inline component render_inline component
expect(page).not_to have_css "li" expect(page.native.inner_html).to be_empty
end end
it "renders a list of targets" do it "renders a list of targets" do

View File

@@ -18,7 +18,7 @@ describe SDG::Targets::TagListComponent do
render_inline component render_inline component
expect(page).not_to have_css "li" expect(page.native.inner_html).to be_empty
end end
it "does not render when the SDG process feature is disabled" do it "does not render when the SDG process feature is disabled" do
@@ -26,7 +26,7 @@ describe SDG::Targets::TagListComponent do
render_inline component render_inline component
expect(page).not_to have_css "li" expect(page.native.inner_html).to be_empty
end end
it "renders a list of targets" do it "renders a list of targets" do

View File

@@ -82,13 +82,13 @@ describe Shared::BannerComponent do
render_inline Shared::BannerComponent.new("debates") render_inline Shared::BannerComponent.new("debates")
expect(page).not_to have_css ".banner" expect(page.native.inner_html).to be_empty
end end
end end
it "does not render anything given nil" do it "does not render anything given nil" do
render_inline Shared::BannerComponent.new(nil) render_inline Shared::BannerComponent.new(nil)
expect(page).not_to have_css ".banner" expect(page.native.inner_html).to be_empty
end end
end end

View File

@@ -4,13 +4,13 @@ describe Shared::LinkListComponent do
it "renders nothing with an empty list" do it "renders nothing with an empty list" do
render_inline Shared::LinkListComponent.new render_inline Shared::LinkListComponent.new
expect(page).not_to have_css "ul" expect(page.native.inner_html).to be_empty
end end
it "returns nothing with a list of nil elements" do it "returns nothing with a list of nil elements" do
render_inline Shared::LinkListComponent.new(nil, nil) render_inline Shared::LinkListComponent.new(nil, nil)
expect(page).not_to have_css "ul" expect(page.native.inner_html).to be_empty
end end
it "generates a list of links" do it "generates a list of links" do