Skip to content

Commit d956508

Browse files
committed
Add more multi role specs
1 parent 62e56d4 commit d956508

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

spec/features/workflows/edit_multi_role_spec.rb

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,19 @@
103103
expect(page).to have_field workflow_checkbox(0, 2)
104104
expect(page).to have_field workflow_checkbox(1, 2)
105105
end
106+
107+
it "pre-selects the union of statuses from all selected roles in the status dialog" do
108+
within "#workflow-table" do
109+
click_link "Status"
110+
end
111+
112+
expect(page).to have_dialog("Statuses")
113+
within_dialog "Statuses" do
114+
expect(page).to have_css(".ng-value-label", text: statuses[0].name)
115+
expect(page).to have_css(".ng-value-label", text: statuses[1].name)
116+
expect(page).to have_css(".ng-value-label", text: statuses[2].name)
117+
end
118+
end
106119
end
107120

108121
context "with a single role selected" do
@@ -268,5 +281,39 @@
268281

269282
expect(page).to have_text("2 roles selected")
270283
end
284+
285+
it "checks all new status checkboxes as fully checked, not indeterminate, when adding a status" do
286+
add_status_via_dialog(statuses[2])
287+
288+
[workflow_checkbox(2, 0), workflow_checkbox(0, 2), workflow_checkbox(2, 1),
289+
workflow_checkbox(1, 2), workflow_checkbox(2, 2)].each do |cb|
290+
expect(page).to have_field cb, checked: true
291+
expect(indeterminate?(cb)).to be false
292+
end
293+
end
294+
295+
context "when no statuses are configured" do
296+
let(:empty_role1) { create(:project_role) }
297+
let(:empty_role2) { create(:project_role) }
298+
299+
before { visit_workflow_edit(roles: [empty_role1, empty_role2]) }
300+
301+
it "shows a blankslate" do
302+
expect(page).to have_text("No status transitions configured")
303+
end
304+
305+
it "preserves all selected roles when adding statuses from the blankslate" do
306+
within "#workflow-table" do
307+
all(:link, "Status").last.click
308+
end
309+
within_dialog "Statuses" do
310+
find(".ng-arrow-wrapper").click
311+
find(".ng-option", text: statuses[0].name).click
312+
click_button "Apply"
313+
end
314+
315+
expect(page).to have_text("2 roles selected")
316+
end
317+
end
271318
end
272319
end

0 commit comments

Comments
 (0)