diff --git a/lms/static/js/edxnotes/models/note.js b/lms/static/js/edxnotes/models/note.js index e9748dafec..3b0a6a4203 100644 --- a/lms/static/js/edxnotes/models/note.js +++ b/lms/static/js/edxnotes/models/note.js @@ -12,6 +12,7 @@ define(['backbone', 'js/edxnotes/utils/utils', 'underscore.string'], function (B 'text': '', 'quote': '', 'ranges': [], + 'tags': [], 'unit': { 'display_name': '', 'url': '', diff --git a/lms/static/js/spec/edxnotes/views/note_item_spec.js b/lms/static/js/spec/edxnotes/views/note_item_spec.js index ca1af97646..617764812c 100644 --- a/lms/static/js/spec/edxnotes/views/note_item_spec.js +++ b/lms/static/js/spec/edxnotes/views/note_item_spec.js @@ -53,8 +53,21 @@ define([ it('should display update value and accompanying text', function() { var view = getView(); - expect(view.$('.reference-title').last()).toContainText('Last Edited:'); - expect(view.$('.reference-meta').last()).toContainText('December 11, 2014 at 11:12AM'); + expect(view.$('.reference-title')[1]).toContainText('Last Edited:'); + expect(view.$('.reference-updated-date').last()).toContainText('December 11, 2014 at 11:12AM'); + }); + + it('should not display tags if there are none', function() { + var view = getView(); + expect(view.$el).not.toContain('.reference-tags'); + expect(view.$('.reference-title').length).toBe(2); + }); + + it('should display tags if they exist', function() { + var view = getView({tags: ["First", "Second"]}); + expect(view.$('.reference-title').length).toBe(3); + expect(view.$('.reference-title')[2]).toContainText('Tags:'); + expect(view.$('.reference-tags').last()).toContainText('First, Second'); }); it('should log the edx.student_notes.used_unit_link event properly', function () { diff --git a/lms/templates/edxnotes/note-item.underscore b/lms/templates/edxnotes/note-item.underscore index 370f71ebc9..f1461dff56 100644 --- a/lms/templates/edxnotes/note-item.underscore +++ b/lms/templates/edxnotes/note-item.underscore @@ -34,5 +34,10 @@

<%- gettext("Last Edited:") %>

<%- updated %> + + <% if (tags.length > 0) { %> +

<%- gettext("Tags:") %>

+ <%- tags.join(", ") %> + <% } %>