diff --git a/cms/static/coffee/spec/views/module_edit_spec.coffee b/cms/static/coffee/spec/views/module_edit_spec.coffee index 5e83ecb42d..baf9ee9c20 100644 --- a/cms/static/coffee/spec/views/module_edit_spec.coffee +++ b/cms/static/coffee/spec/views/module_edit_spec.coffee @@ -72,3 +72,14 @@ describe "CMS.Views.ModuleEdit", -> it "loads the .xmodule-display inside the module editor", -> expect(XModule.loadModule).toHaveBeenCalled() expect(XModule.loadModule.mostRecentCall.args[0]).toBe($('.xmodule_display')) + + describe "changedMetadata", -> + it "returns empty if no metadata loaded", -> + expect(@moduleEdit.changedMetadata()).toEqual({}) + + it "returns only changed values", -> + @moduleEdit.originalMetadata = {'foo', 'bar'} + spyOn(@moduleEdit, 'metadata').andReturn({'a': '', 'b': 'before', 'c': ''}) + @moduleEdit.loadEdit() + @moduleEdit.metadata.andReturn({'a': '', 'b': 'after', 'd': 'only_after'}) + expect(@moduleEdit.changedMetadata()).toEqual({'b' : 'after', 'd' : 'only_after'}) diff --git a/cms/templates/widgets/metadata-edit.html b/cms/templates/widgets/metadata-edit.html index 39ad8e480c..9693c18e9c 100644 --- a/cms/templates/widgets/metadata-edit.html +++ b/cms/templates/widgets/metadata-edit.html @@ -22,8 +22,8 @@ value='${field_value["field"].to_json(field_value["value"])}' % endif size='60' /> - ## Change to False to see all the information being passed through. - % if True: + ## Change to True to see all the information being passed through. + % if False: