Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong behavior showing proposals on map #236

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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