From 6cc8c47ca00feb6a0135af1103fd064603847edc Mon Sep 17 00:00:00 2001 From: Afeef Janjua Date: Fri, 2 Oct 2015 21:56:17 +0500 Subject: [PATCH] TNL-3258 Reset group configuration model when a child content group is deleted (+5 squashed commits) Squashed commits: [450761c] found an alternative way to restore model when any of the nested model is deleted [1b7eb85] passed the context to the inner functions [c87dafd] refactored the model access using encapsulation instead of directly accessing it [5d025ff] return the promise [d8d1f50] fixup! quality (+1 squashed commit) Squashed commits: [daa7f81] reset the configuration when the model is deleted (+1 squashed commit) Squashed commits: [c7f41f7] reverted: skip test_can_delete_unused_content_group due to flakiness --- cms/static/js/models/group_configuration.js | 7 +++++++ .../test/acceptance/tests/studio/test_studio_settings.py | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cms/static/js/models/group_configuration.js b/cms/static/js/models/group_configuration.js index 27080835fb..82ac39eae2 100644 --- a/cms/static/js/models/group_configuration.js +++ b/cms/static/js/models/group_configuration.js @@ -36,8 +36,11 @@ function(Backbone, _, str, gettext, GroupModel, GroupCollection) { }], initialize: function(attributes, options) { + this.on('remove:groups', this.groupRemoved); + this.canBeEmpty = options && options.canBeEmpty; this.setOriginalAttributes(); + return this; }, @@ -120,6 +123,10 @@ function(Backbone, _, str, gettext, GroupModel, GroupCollection) { }; } } + }, + + groupRemoved: function () { + this.setOriginalAttributes(); } }); diff --git a/common/test/acceptance/tests/studio/test_studio_settings.py b/common/test/acceptance/tests/studio/test_studio_settings.py index e114b6366c..eca0ca2d8e 100644 --- a/common/test/acceptance/tests/studio/test_studio_settings.py +++ b/common/test/acceptance/tests/studio/test_studio_settings.py @@ -4,7 +4,6 @@ Acceptance tests for Studio's Setting pages """ from __future__ import unicode_literals from nose.plugins.attrib import attr -from unittest import skip from base_studio_test import StudioCourseTest from bok_choy.promise import EmptyPromise @@ -152,7 +151,6 @@ class ContentGroupConfigurationTest(StudioCourseTest): config = self.group_configurations_page.content_groups[0] self.assertTrue(config.delete_button_is_disabled) - @skip("TNL-3258") def test_can_delete_unused_content_group(self): """ Scenario: Ensure that the user can delete unused content group.