Merge branch 'next-minor' into develop
This commit is contained in:
commit
1b9ab16039
15 changed files with 46 additions and 26 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
## Refactor
|
## Refactor
|
||||||
* Remove unused setPreload function [#7354](https://github.com/diaspora/diaspora/pull/7354)
|
* Remove unused setPreload function [#7354](https://github.com/diaspora/diaspora/pull/7354)
|
||||||
|
* Remove jQuery deprecations [#7356](https://github.com/diaspora/diaspora/pull/7356)
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#js-app-logo").error(function () {
|
$("#js-app-logo").on("error", function() {
|
||||||
$(this).attr("src", ImagePaths.get("user/default.png"));
|
$(this).attr("src", ImagePaths.get("user/default.png"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ app.views.Base = Backbone.View.extend({
|
||||||
.attr("data-template", _.last(this.templateName.split("/")));
|
.attr("data-template", _.last(this.templateName.split("/")));
|
||||||
|
|
||||||
// add avatar fallback if it can't be loaded
|
// add avatar fallback if it can't be loaded
|
||||||
this.$el.find(this.avatars.selector).error(this.avatars.fallback);
|
this.$el.find(this.avatars.selector).on("error", this.avatars.fallback);
|
||||||
|
|
||||||
// add placeholder support for old browsers
|
// add placeholder support for old browsers
|
||||||
this.$("input, textarea").placeholder();
|
this.$("input, textarea").placeholder();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ app.views.ContactStream = Backbone.View.extend({
|
||||||
$("#paginate .loader").removeClass("hidden");
|
$("#paginate .loader").removeClass("hidden");
|
||||||
$.ajax(this._fetchUrl(), {
|
$.ajax(this._fetchUrl(), {
|
||||||
context: this
|
context: this
|
||||||
}).success(function(response) {
|
}).done(function(response) {
|
||||||
if (response.length === 0) {
|
if (response.length === 0) {
|
||||||
this.onEmptyResponse();
|
this.onEmptyResponse();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ app.views.NotificationDropdown = app.views.Base.extend({
|
||||||
|
|
||||||
afterNotificationChanges: function(node) {
|
afterNotificationChanges: function(node) {
|
||||||
node.find(".unread-toggle .entypo-eye").tooltip("destroy").tooltip();
|
node.find(".unread-toggle .entypo-eye").tooltip("destroy").tooltip();
|
||||||
node.find(this.avatars.selector).error(this.avatars.fallback);
|
node.find(this.avatars.selector).on("error", this.avatars.fallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
finishLoading: function() {
|
finishLoading: function() {
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ app.views.PublisherUploader = Backbone.View.extend({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
success: function() {
|
success: function() {
|
||||||
$.when(photo.fadeOut(400)).then(function(){
|
photo.fadeOut(400, function() {
|
||||||
photo.remove();
|
photo.remove();
|
||||||
|
|
||||||
if( self.publisher.$(".publisher_photo").length === 0 ) {
|
if( self.publisher.$(".publisher_photo").length === 0 ) {
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
// if there is data in the publisher we ask for a confirmation
|
// if there is data in the publisher we ask for a confirmation
|
||||||
// before the user is able to leave the page
|
// before the user is able to leave the page
|
||||||
$(window).on("beforeunload", _.bind(this._beforeUnload, this));
|
$(window).on("beforeunload", _.bind(this._beforeUnload, this));
|
||||||
$(window).unload(this.clear.bind(this));
|
$(window).on("unload", this.clear.bind(this));
|
||||||
|
|
||||||
// hide close and preview buttons and manage services link
|
// hide close and preview buttons and manage services link
|
||||||
// in case publisher is standalone
|
// in case publisher is standalone
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ app.views.Tags = Backbone.View.extend({
|
||||||
app.publisher.setText("#"+ opts.hashtagName + " ");
|
app.publisher.setText("#"+ opts.hashtagName + " ");
|
||||||
}
|
}
|
||||||
// add avatar fallback if it can't be loaded
|
// add avatar fallback if it can't be loaded
|
||||||
$(app.views.Base.prototype.avatars.selector).error(app.views.Base.prototype.avatars.fallback);
|
$(app.views.Base.prototype.avatars.selector).on("error", app.views.Base.prototype.avatars.fallback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// @license-end
|
// @license-end
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ describe("app", function() {
|
||||||
spyOn(app.Router.prototype, "initialize");
|
spyOn(app.Router.prototype, "initialize");
|
||||||
spyOn(app, "setupDummyPreloads");
|
spyOn(app, "setupDummyPreloads");
|
||||||
spyOn(app, "setupUser");
|
spyOn(app, "setupUser");
|
||||||
|
spyOn(app, "setupAspects");
|
||||||
spyOn(app, "setupHeader");
|
spyOn(app, "setupHeader");
|
||||||
spyOn(app, "setupBackboneLinks");
|
spyOn(app, "setupBackboneLinks");
|
||||||
spyOn(app, "setupGlobalViews");
|
spyOn(app, "setupGlobalViews");
|
||||||
|
|
@ -16,6 +17,7 @@ describe("app", function() {
|
||||||
expect(app.Router.prototype.initialize).toHaveBeenCalled();
|
expect(app.Router.prototype.initialize).toHaveBeenCalled();
|
||||||
expect(app.setupDummyPreloads).toHaveBeenCalled();
|
expect(app.setupDummyPreloads).toHaveBeenCalled();
|
||||||
expect(app.setupUser).toHaveBeenCalled();
|
expect(app.setupUser).toHaveBeenCalled();
|
||||||
|
expect(app.setupAspects).toHaveBeenCalled();
|
||||||
expect(app.setupHeader).toHaveBeenCalled();
|
expect(app.setupHeader).toHaveBeenCalled();
|
||||||
expect(app.setupBackboneLinks).toHaveBeenCalled();
|
expect(app.setupBackboneLinks).toHaveBeenCalled();
|
||||||
expect(app.setupGlobalViews).toHaveBeenCalled();
|
expect(app.setupGlobalViews).toHaveBeenCalled();
|
||||||
|
|
@ -39,18 +41,23 @@ describe("app", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("setupForms", function() {
|
describe("setupForms", function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
spec.content().append("<textarea/> <input/>");
|
||||||
|
});
|
||||||
|
|
||||||
it("calls jQuery.placeholder() for inputs", function() {
|
it("calls jQuery.placeholder() for inputs", function() {
|
||||||
spyOn($.fn, "placeholder");
|
spyOn($.fn, "placeholder");
|
||||||
app.setupForms();
|
app.setupForms();
|
||||||
expect($.fn.placeholder).toHaveBeenCalled();
|
expect($.fn.placeholder).toHaveBeenCalled();
|
||||||
expect($.fn.placeholder.calls.mostRecent().object.selector).toBe("input, textarea");
|
expect($.fn.placeholder.calls.mostRecent().object.is($("input"))).toBe(true);
|
||||||
|
expect($.fn.placeholder.calls.mostRecent().object.is($("textarea"))).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("initializes autosize for textareas", function(){
|
it("initializes autosize for textareas", function(){
|
||||||
spyOn(window, "autosize");
|
spyOn(window, "autosize");
|
||||||
app.setupForms();
|
app.setupForms();
|
||||||
expect(window.autosize).toHaveBeenCalled();
|
expect(window.autosize).toHaveBeenCalled();
|
||||||
expect(window.autosize.calls.mostRecent().args[0].selector).toBe("textarea");
|
expect(window.autosize.calls.mostRecent().args[0].is($("textarea"))).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,14 +123,18 @@ describe('app.Router', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("gettingStarted", function() {
|
describe("gettingStarted", function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
spec.content().append($("<div id='hello-there'>"));
|
||||||
|
});
|
||||||
|
|
||||||
it("renders app.pages.GettingStarted", function() {
|
it("renders app.pages.GettingStarted", function() {
|
||||||
app.router.navigate("/getting_started", {trigger: true});
|
app.router.navigate("/getting_started", {trigger: true});
|
||||||
expect(app.page.$el.selector).toEqual("#hello-there");
|
expect(app.page.$el.is($("#hello-there"))).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders app.pages.GettingStarted when the URL has a trailing slash", function() {
|
it("renders app.pages.GettingStarted when the URL has a trailing slash", function() {
|
||||||
app.router.navigate("/getting_started/", {trigger: true});
|
app.router.navigate("/getting_started/", {trigger: true});
|
||||||
expect(app.page.$el.selector).toEqual("#hello-there");
|
expect(app.page.$el.is($("#hello-there"))).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ describe("app.views.PublisherMention", function() {
|
||||||
this.view = new app.views.PublisherMention({ el: "#publisher" });
|
this.view = new app.views.PublisherMention({ el: "#publisher" });
|
||||||
expect(app.views.SearchBase.prototype.initialize).toHaveBeenCalled();
|
expect(app.views.SearchBase.prototype.initialize).toHaveBeenCalled();
|
||||||
var call = app.views.SearchBase.prototype.initialize.calls.mostRecent();
|
var call = app.views.SearchBase.prototype.initialize.calls.mostRecent();
|
||||||
expect(call.args[0].typeaheadInput.selector).toBe("#publisher .typeahead-mention-box");
|
expect(call.args[0].typeaheadInput.is($("#publisher .typeahead-mention-box"))).toBe(true);
|
||||||
expect(call.args[0].customSearch).toBeTruthy();
|
expect(call.args[0].customSearch).toBeTruthy();
|
||||||
expect(call.args[0].autoselect).toBeTruthy();
|
expect(call.args[0].autoselect).toBeTruthy();
|
||||||
expect(call.args[0].remoteRoute).toEqual({url: "/contacts"});
|
expect(call.args[0].remoteRoute).toEqual({url: "/contacts"});
|
||||||
|
|
|
||||||
|
|
@ -591,7 +591,7 @@ describe("app.views.Publisher", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
context('photo removal', function() {
|
context('photo removal', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function(done) {
|
||||||
this.view = new app.views.Publisher();
|
this.view = new app.views.Publisher();
|
||||||
this.view.wrapperEl.addClass("with_attachments");
|
this.view.wrapperEl.addClass("with_attachments");
|
||||||
this.view.photozoneEl.html(
|
this.view.photozoneEl.html(
|
||||||
|
|
@ -603,6 +603,7 @@ describe("app.views.Publisher", function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
spyOn(jQuery, 'ajax').and.callFake(function(opts) { opts.success(); });
|
spyOn(jQuery, 'ajax').and.callFake(function(opts) { opts.success(); });
|
||||||
|
this.view.viewUploader.on("change", done);
|
||||||
this.view.photozoneEl.find(".x").click();
|
this.view.photozoneEl.find(".x").click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ describe("app.views.Search", function() {
|
||||||
spyOn(app.views.SearchBase.prototype, "initialize");
|
spyOn(app.views.SearchBase.prototype, "initialize");
|
||||||
this.view = new app.views.Search({el: "#search_people_form"});
|
this.view = new app.views.Search({el: "#search_people_form"});
|
||||||
var call = app.views.SearchBase.prototype.initialize.calls.mostRecent();
|
var call = app.views.SearchBase.prototype.initialize.calls.mostRecent();
|
||||||
expect(call.args[0].typeaheadInput.selector).toBe("#search_people_form #q");
|
expect(call.args[0].typeaheadInput.is($("#search_people_form #q"))).toBe(true);
|
||||||
expect(call.args[0].remoteRoute).toEqual({url: "/search"});
|
expect(call.args[0].remoteRoute).toEqual({url: "/search"});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,42 +119,49 @@ describe("app.views.Base", function(){
|
||||||
|
|
||||||
context("calling out to third party plugins", function() {
|
context("calling out to third party plugins", function() {
|
||||||
it("replaces .time with relative time ago in words", function() {
|
it("replaces .time with relative time ago in words", function() {
|
||||||
|
this.view.templateName = false;
|
||||||
spyOn($.fn, "timeago");
|
spyOn($.fn, "timeago");
|
||||||
|
this.view.$el.append("<time/>");
|
||||||
this.view.render();
|
this.view.render();
|
||||||
expect($.fn.timeago).toHaveBeenCalled();
|
expect($.fn.timeago).toHaveBeenCalled();
|
||||||
expect($.fn.timeago.calls.mostRecent().object.selector).toBe("time");
|
expect($.fn.timeago.calls.mostRecent().object.first().is("time")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("initializes tooltips declared with the view's tooltipSelector property", function(){
|
it("initializes tooltips declared with the view's tooltipSelector property", function(){
|
||||||
|
this.view.templateName = false;
|
||||||
this.view.tooltipSelector = ".christopher_columbus, .barrack_obama, .block_user";
|
this.view.tooltipSelector = ".christopher_columbus, .barrack_obama, .block_user";
|
||||||
|
this.view.$el.append("<div class='christopher_columbus barrack_obama block_user'/>");
|
||||||
|
|
||||||
spyOn($.fn, "tooltip");
|
spyOn($.fn, "tooltip");
|
||||||
this.view.render();
|
this.view.render();
|
||||||
expect($.fn.tooltip.calls.mostRecent().object.selector).toBe(".christopher_columbus, .barrack_obama, .block_user");
|
expect(
|
||||||
});
|
$.fn.tooltip.calls.mostRecent().object.is(".christopher_columbus, .barrack_obama, .block_user")
|
||||||
|
).toBe(true);
|
||||||
it("applies infield labels", function(){
|
|
||||||
spyOn($.fn, "placeholder");
|
|
||||||
this.view.render();
|
|
||||||
expect($.fn.placeholder).toHaveBeenCalled();
|
|
||||||
expect($.fn.placeholder.calls.mostRecent().object.selector).toBe("input, textarea");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("#renderTemplate", function(){
|
describe("#renderTemplate", function(){
|
||||||
|
beforeEach(function() {
|
||||||
|
this.view.$el.htmlOriginal = this.view.$el.html;
|
||||||
|
spyOn(this.view.$el, "html").and.callFake(function() {
|
||||||
|
this.htmlOriginal("<input><textarea/></input>");
|
||||||
|
return this;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("calls jQuery.placeholder() for inputs", function() {
|
it("calls jQuery.placeholder() for inputs", function() {
|
||||||
spyOn($.fn, "placeholder");
|
spyOn($.fn, "placeholder");
|
||||||
this.view.renderTemplate();
|
this.view.renderTemplate();
|
||||||
expect($.fn.placeholder).toHaveBeenCalled();
|
expect($.fn.placeholder).toHaveBeenCalled();
|
||||||
expect($.fn.placeholder.calls.mostRecent().object.selector).toBe("input, textarea");
|
expect($.fn.placeholder.calls.mostRecent().object.is("input, textarea")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("initializes autosize for textareas", function(){
|
it("initializes autosize for textareas", function(){
|
||||||
spyOn(window, "autosize");
|
spyOn(window, "autosize");
|
||||||
this.view.renderTemplate();
|
this.view.renderTemplate();
|
||||||
expect(window.autosize).toHaveBeenCalled();
|
expect(window.autosize).toHaveBeenCalled();
|
||||||
expect(window.autosize.calls.mostRecent().args[0].selector).toBe("textarea");
|
expect(window.autosize.calls.mostRecent().args[0].is("textarea")).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ describe("Diaspora.Mobile", function(){
|
||||||
it("calls autosize for textareas", function(){
|
it("calls autosize for textareas", function(){
|
||||||
Diaspora.Mobile.initialize();
|
Diaspora.Mobile.initialize();
|
||||||
expect(window.autosize).toHaveBeenCalled();
|
expect(window.autosize).toHaveBeenCalled();
|
||||||
expect(window.autosize.calls.mostRecent().args[0].selector).toBe("textarea");
|
expect(window.autosize.calls.mostRecent().args[0].is($("textarea"))).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("deactivates shield", function(){
|
it("deactivates shield", function(){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue