The `map` class is applied to the map element by LeafletJS; using it in the container led to hacks like adding an `inline` class to fix the fact that the container was using the `height` rule of the `.map` elements. Even though we don't add styles for them, I'm adding the `budgets-map` and `budget-investments-map` HTML classes so these elements can still be easily selected with CSS and JavaScript.
35 lines
885 B
Ruby
35 lines
885 B
Ruby
require "rails_helper"
|
|
|
|
describe Budgets::MapComponent do
|
|
let(:budget) { build(:budget) }
|
|
|
|
describe "#render?" do
|
|
it "is rendered after the informing phase when the map feature is enabled" do
|
|
Setting["feature.map"] = true
|
|
budget.phase = "accepting"
|
|
|
|
render_inline Budgets::MapComponent.new(budget)
|
|
|
|
expect(page.find(".budgets-map")).to have_content "located geographically"
|
|
end
|
|
|
|
it "is not rendered during the informing phase" do
|
|
Setting["feature.map"] = true
|
|
budget.phase = "informing"
|
|
|
|
render_inline Budgets::MapComponent.new(budget)
|
|
|
|
expect(page).not_to be_rendered
|
|
end
|
|
|
|
it "is not rendered when the map feature is disabled" do
|
|
Setting["feature.map"] = false
|
|
budget.phase = "accepting"
|
|
|
|
render_inline Budgets::MapComponent.new(budget)
|
|
|
|
expect(page).not_to be_rendered
|
|
end
|
|
end
|
|
end
|