Skip to content

Commit

Permalink
Fix wrong behavior showing proposals on map (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi authored Sep 25, 2023
1 parent 05ab884 commit 25d2e7f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class Controller {
setFetcher(Fetcher) {
let checkProposalState = function (node, map) {
const showConfig = map.config.show;
return showConfig[node.state] || showConfig.notAnswered;
return showConfig[node.state || "notAnswered"];
}

this.fetcher = new Fetcher(this);
Expand Down
17 changes: 17 additions & 0 deletions spec/system/awesome_map_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,23 @@
end
end

context "when only the not answered option is enabled" do
let(:show_accepted) { false }
let(:show_evaluating) { false }
let(:show_rejected) { false }
let(:show_withdrawn) { false }
let(:show_not_answered) { true }

it "only shows proposal without state" do
sleep(1)
expect(page.body).not_to have_selector("div[title='#{accepted_proposal.title["en"]}']")
expect(page.body).not_to have_selector("div[title='#{evaluating_proposal.title["en"]}']")
expect(page.body).not_to have_selector("div[title='#{rejected_proposal.title["en"]}']")
expect(page.body).not_to have_selector("div[title='#{withdrawn_proposal.title["en"]}']")
expect(page.body).to have_selector("div[title='#{null_state_proposal.title["en"]}']")
end
end

# TODO: figure out a way to test leaflet without any map provider
# it "shows the proposal component as a menu" do
# expect(page.body).to have_content(".awesome_map-component_#{component.id}")
Expand Down

0 comments on commit 25d2e7f

Please sign in to comment.