From 11c04b5e39759bedde9b619d64d4d57b49f9462c Mon Sep 17 00:00:00 2001 From: Ed Schiebel Date: Mon, 18 Nov 2019 13:52:11 -0500 Subject: [PATCH] Improve handling of the "blank" option from group selector closes LA-141 The empty option was added when the "New Group Category" option was converted to a button for accessibility (see OUT-57). Now I hide the selector + its label if there are no group sets. test plan: - in a course with no group sets - create an assignment - check the "group assignment" checkbox > expect the "create group set" modal to appear - dismiss it w/o creating a group > expect the "group set" label and its to be displayed - editing an assignment that has at least 1 group set - check the group assignment checkbox > expect the select with "Select a group catetory" item displayed > expect the other options to be the existing group sets - try to save > expect an alert that you must select a group set - select a group set > expect to be able to save - edit again > expect the group to be selected From the ticket - Create a course with at least one student who is part of a group - Create or edit a group assignments - Select the group set dropdown and see that there is an extra empty selection there - Give your group assignment a due date and save it - Edit your assignment and select the empty option from the group set dropdown and try to save - After receiving the error message, select the actual group set - Change the date from being assigned to everyone to just being assigned to the student's group specifically - Save the assignment - As the student view the assignment and notice that the due date does not display. Change-Id: I53f52f38f89bb37bd26ad0cd892570138178ad65 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/217643 Tested-by: Service Cloud Jenkins Tested-by: Jenkins Reviewed-by: Carl Kibler QA-Review: Carl Kibler QA-Review: Jeremy Putnam Product-Review: Carl Kibler --- .../assignments/GroupCategorySelector.coffee | 20 +++-- .../GroupCategorySelector.handlebars | 81 +++++++++---------- .../assignments/GroupCategorySelectorSpec.js | 31 ++++++- 3 files changed, 78 insertions(+), 54 deletions(-) diff --git a/app/coffeescripts/views/assignments/GroupCategorySelector.coffee b/app/coffeescripts/views/assignments/GroupCategorySelector.coffee index 21c776dcf14..8a6f4b97510 100644 --- a/app/coffeescripts/views/assignments/GroupCategorySelector.coffee +++ b/app/coffeescripts/views/assignments/GroupCategorySelector.coffee @@ -29,6 +29,7 @@ export default class GroupCategorySelector extends Backbone.View template: template + GROUP_CATEGORY = '#assignment_group_category' GROUP_CATEGORY_ID = '#assignment_group_category_id' CREATE_GROUP_CATEGORY_ID = '#create_group_category_id' HAS_GROUP_CATEGORY = '#has_group_category' @@ -36,6 +37,7 @@ export default class GroupCategorySelector extends Backbone.View els: do -> els = {} + els["#{GROUP_CATEGORY}"] = '$groupCategory' els["#{GROUP_CATEGORY_ID}"] = '$groupCategoryID' els["#{HAS_GROUP_CATEGORY}"] = '$hasGroupCategory' els["#{GROUP_CATEGORY_OPTIONS}"] = '$groupCategoryOptions' @@ -66,11 +68,11 @@ export default class GroupCategorySelector extends Backbone.View if _.isEmpty(@groupCategories) StudentGroupStore.setSelectedGroupSet(null) else if !selectedID? or !_.findWhere(@groupCategories, {id: selectedID.toString()})? - StudentGroupStore.setSelectedGroupSet('blank') + StudentGroupStore.setSelectedGroupSet(null) else StudentGroupStore.setSelectedGroupSet(selectedID) super - @$groupCategoryID.toggleAccessibly !_.isEmpty(@groupCategories) + @$groupCategory.toggleAccessibly !_.isEmpty(@groupCategories) groupCategorySelected: => newSelectedId = @$groupCategoryID.val() @@ -83,10 +85,11 @@ export default class GroupCategorySelector extends Backbone.View $newCategory = $('