Fix component specs using "within"
These specs were passing because the `within` method does not work in components specs. We have to use `page.find` instead.
This commit is contained in:
@@ -7,10 +7,12 @@ describe Admin::Poll::Officers::OfficersComponent, type: :component do
|
|||||||
let(:component) { Admin::Poll::Officers::OfficersComponent.new(officers) }
|
let(:component) { Admin::Poll::Officers::OfficersComponent.new(officers) }
|
||||||
|
|
||||||
it "renders as many rows as officers" do
|
it "renders as many rows as officers" do
|
||||||
within "tbody" do
|
render_inline component
|
||||||
expect(page).to have_css "tr", count: 2
|
|
||||||
expect(page).to have_css "a", count: 2
|
tbody = page.find("tbody")
|
||||||
end
|
|
||||||
|
expect(tbody).to have_css "tr", count: 2
|
||||||
|
expect(tbody).to have_css "a", count: 2
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders link to destroy for existing officers" do
|
it "renders link to destroy for existing officers" do
|
||||||
|
|||||||
@@ -21,10 +21,8 @@ describe SDGManagement::SubnavigationComponent, type: :component do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "renders given block within active panel" do
|
it "renders given block within active panel" do
|
||||||
render_inline component
|
render_inline(component) { "Tab content" }
|
||||||
|
|
||||||
within "#goals.tabs-panel.is-active" do
|
expect(page.find(".tabs-panel.is-active")).to have_content("Tab content")
|
||||||
expect(page).to have_content("Tab content")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user