diff --git a/cms/static/coffee/fixtures/alert.underscore b/cms/static/coffee/fixtures/alert.underscore new file mode 120000 index 0000000000..35fe9133d1 --- /dev/null +++ b/cms/static/coffee/fixtures/alert.underscore @@ -0,0 +1 @@ +../../../templates/js/alert.underscore \ No newline at end of file diff --git a/cms/static/coffee/fixtures/notification.underscore b/cms/static/coffee/fixtures/notification.underscore new file mode 120000 index 0000000000..71b1ba2d89 --- /dev/null +++ b/cms/static/coffee/fixtures/notification.underscore @@ -0,0 +1 @@ +../../../templates/js/notification.underscore \ No newline at end of file diff --git a/cms/static/coffee/fixtures/prompt.underscore b/cms/static/coffee/fixtures/prompt.underscore new file mode 120000 index 0000000000..c4be9fdc58 --- /dev/null +++ b/cms/static/coffee/fixtures/prompt.underscore @@ -0,0 +1 @@ +../../../templates/js/prompt.underscore \ No newline at end of file diff --git a/cms/static/coffee/fixtures/system-feedback.underscore b/cms/static/coffee/fixtures/system-feedback.underscore deleted file mode 120000 index 10893f87c4..0000000000 --- a/cms/static/coffee/fixtures/system-feedback.underscore +++ /dev/null @@ -1 +0,0 @@ -../../../templates/js/system-feedback.underscore \ No newline at end of file diff --git a/cms/static/coffee/spec/models/feedback_spec.coffee b/cms/static/coffee/spec/models/feedback_spec.coffee index b878be0dc7..f5694055d1 100644 --- a/cms/static/coffee/spec/models/feedback_spec.coffee +++ b/cms/static/coffee/spec/models/feedback_spec.coffee @@ -11,18 +11,6 @@ describe "CMS.Models.SystemFeedback", -> it "should not have a type set by default", -> expect(@model.get("type")).toBeNull() - it "should be shown by default", -> - expect(@model.get("shown")).toEqual(true) - - it "should trigger a change event on calling .hide()", -> - spy = jasmine.createSpy() - @model.on("change", spy) - - @model.hide() - - expect(@model.get("shown")).toEqual(false) - expect(spy).toHaveBeenCalled() - describe "CMS.Models.WarningMessage", -> beforeEach -> diff --git a/cms/static/coffee/spec/views/feedback_spec.coffee b/cms/static/coffee/spec/views/feedback_spec.coffee index b8d0d269da..41f8c52f43 100644 --- a/cms/static/coffee/spec/views/feedback_spec.coffee +++ b/cms/static/coffee/spec/views/feedback_spec.coffee @@ -1,29 +1,23 @@ -describe "CMS.Views.SystemFeedback", -> - tpl = readFixtures('system-feedback.underscore') - # CMS.Views.SystemFeedback looks for a template on the page when the code - # is loaded, and even if we set that template on the page using a fixture, - # CMS.Views.SystemFeedback has already been loaded, and so that template - # won't be picked up. This is a dirty hack, to load that template into - # the code after the code has been loaded already. - CMS.Views.SystemFeedback.prototype.template = _.template(tpl) +describe "CMS.Views.Alert as base class", -> + tpl = readFixtures('alert.underscore') beforeEach -> - setFixtures(sandbox({id: "page-notification"})) + setFixtures(sandbox({id: "page-alert"})) + appendSetFixtures($(" + + ## javascript @@ -68,8 +74,8 @@ $(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) { "actions": { "primary": { "text": "Dismiss", - "click": function() { - this.hide(); + "click": function(view) { + view.hide(); } } } diff --git a/cms/templates/js/alert.underscore b/cms/templates/js/alert.underscore new file mode 100644 index 0000000000..908c00eebb --- /dev/null +++ b/cms/templates/js/alert.underscore @@ -0,0 +1,45 @@ +