Fix jasmine tests
Fix notifications jasmine tests
This commit is contained in:
parent
f64eb9ff41
commit
700df9af23
5 changed files with 11 additions and 11 deletions
|
|
@ -15,7 +15,7 @@ app.views.Notifications = Backbone.View.extend({
|
||||||
toggleUnread: function(evt) {
|
toggleUnread: function(evt) {
|
||||||
var note = $(evt.target).closest(".stream_element");
|
var note = $(evt.target).closest(".stream_element");
|
||||||
var unread = note.hasClass("unread");
|
var unread = note.hasClass("unread");
|
||||||
var guid = note.data.guid;
|
var guid = note.data("guid");
|
||||||
if (unread){ this.setRead(guid); }
|
if (unread){ this.setRead(guid); }
|
||||||
else { this.setUnread(guid); }
|
else { this.setUnread(guid); }
|
||||||
},
|
},
|
||||||
|
|
@ -52,8 +52,8 @@ app.views.Notifications = Backbone.View.extend({
|
||||||
|
|
||||||
updateView: function(guid, type, unread) {
|
updateView: function(guid, type, unread) {
|
||||||
var change = unread ? 1 : -1,
|
var change = unread ? 1 : -1,
|
||||||
allNotes = $("ul.list-group > a:eq(0) .badge"),
|
allNotes = $(".list-group > a:eq(0) .badge"),
|
||||||
typeNotes = $("ul.list-group > a[data-type=" + type + "] .badge"),
|
typeNotes = $(".list-group > a[data-type=" + type + "] .badge"),
|
||||||
headerBadge = $("#notification_badge .badge_count"),
|
headerBadge = $("#notification_badge .badge_count"),
|
||||||
note = $(".stream_element[data-guid=" + guid + "]"),
|
note = $(".stream_element[data-guid=" + guid + "]"),
|
||||||
markAllReadLink = $("a#mark_all_read_link"),
|
markAllReadLink = $("a#mark_all_read_link"),
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ app.views.PublisherUploader = Backbone.View.extend({
|
||||||
|
|
||||||
// add form input element
|
// add form input element
|
||||||
publisher.$(".content_creation form").append(
|
publisher.$(".content_creation form").append(
|
||||||
"<input type=\"hidden\", value=\"\"+id+\"\" name=\"photos[]\" />"
|
"<input type=\"hidden\", value=\""+id+"\" name=\"photos[]\" />"
|
||||||
);
|
);
|
||||||
|
|
||||||
// replace placeholder
|
// replace placeholder
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,8 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
var form = this.$(".content_creation form");
|
var form = this.$(".content_creation form");
|
||||||
|
|
||||||
this.view_services = new app.views.PublisherServices({
|
this.view_services = new app.views.PublisherServices({
|
||||||
el: this.$('#publisher_service_icons'),
|
el: this.$("#publisher_service_icons"),
|
||||||
input: this.el_input,
|
input: this.inputEl,
|
||||||
form: form
|
form: form
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ describe("app.views.Notifications", function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
it('changes the "all notifications" count', function() {
|
it('changes the "all notifications" count', function() {
|
||||||
var badge = $('ul.list-group > a:eq(0) .badge');
|
var badge = $(".list-group > a:eq(0) .badge");
|
||||||
var count = parseInt(badge.text());
|
var count = parseInt(badge.text());
|
||||||
|
|
||||||
this.view.updateView(this.guid, this.type, true);
|
this.view.updateView(this.guid, this.type, true);
|
||||||
|
|
@ -51,7 +51,7 @@ describe("app.views.Notifications", function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
it('changes the notification type count', function() {
|
it('changes the notification type count', function() {
|
||||||
var badge = $('ul.list-group > a[data-type=' + this.type + '] .badge');
|
var badge = $(".list-group > a[data-type=" + this.type + "] .badge");
|
||||||
var count = parseInt(badge.text());
|
var count = parseInt(badge.text());
|
||||||
|
|
||||||
this.view.updateView(this.guid, this.type, true);
|
this.view.updateView(this.guid, this.type, true);
|
||||||
|
|
|
||||||
|
|
@ -473,7 +473,7 @@ describe("app.views.Publisher", function() {
|
||||||
it('shows progress in percent', function() {
|
it('shows progress in percent', function() {
|
||||||
this.uploader.onProgress(null, 'test.jpg', 20, 100);
|
this.uploader.onProgress(null, 'test.jpg', 20, 100);
|
||||||
|
|
||||||
var info = this.view.viewUploader.infoEl;
|
var info = this.view.viewUploader.info;
|
||||||
expect(info.text()).toContain('test.jpg');
|
expect(info.text()).toContain('test.jpg');
|
||||||
expect(info.text()).toContain('20%');
|
expect(info.text()).toContain('20%');
|
||||||
});
|
});
|
||||||
|
|
@ -509,7 +509,7 @@ describe("app.views.Publisher", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows it in text form', function() {
|
it('shows it in text form', function() {
|
||||||
var info = this.view.viewUploader.infoEl;
|
var info = this.view.viewUploader.info;
|
||||||
expect(info.text()).toBe(Diaspora.I18n.t('photo_uploader.completed', {file: 'test.jpg'}));
|
expect(info.text()).toBe(Diaspora.I18n.t('photo_uploader.completed', {file: 'test.jpg'}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -547,7 +547,7 @@ describe("app.views.Publisher", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows error message', function() {
|
it('shows error message', function() {
|
||||||
var info = this.view.viewUploader.infoEl;
|
var info = this.view.viewUploader.info;
|
||||||
expect(info.text()).toBe(Diaspora.I18n.t('photo_uploader.error', {file: 'test.jpg'}));
|
expect(info.text()).toBe(Diaspora.I18n.t('photo_uploader.error', {file: 'test.jpg'}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue