|
103 | 103 | expect(page).to have_field workflow_checkbox(0, 2) |
104 | 104 | expect(page).to have_field workflow_checkbox(1, 2) |
105 | 105 | 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 |
106 | 119 | end |
107 | 120 |
|
108 | 121 | context "with a single role selected" do |
|
268 | 281 |
|
269 | 282 | expect(page).to have_text("2 roles selected") |
270 | 283 | 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 |
271 | 318 | end |
272 | 319 | end |
0 commit comments