Commit 2739259f authored by Senya's avatar Senya Committed by Steffen van Bergerem

some more replacements for deprecated jquery methods

closes #7356
parent f36a4cd1
......@@ -2,6 +2,7 @@
## Refactor
* 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
......
$(document).ready(function() {
$("#js-app-logo").error(function () {
$("#js-app-logo").on("error", function() {
$(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("/")));
// 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
this.$("input, textarea").placeholder();
......
......@@ -18,7 +18,7 @@ app.views.ContactStream = Backbone.View.extend({
$("#paginate .loader").removeClass("hidden");
$.ajax(this._fetchUrl(), {
context: this
}).success(function(response) {
}).done(function(response) {
if (response.length === 0) {
this.onEmptyResponse();
} else {
......
......@@ -96,7 +96,7 @@ app.views.NotificationDropdown = app.views.Base.extend({
afterNotificationChanges: function(node) {
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() {
......
......@@ -149,7 +149,7 @@ app.views.PublisherUploader = Backbone.View.extend({
dataType: "json",
type: "DELETE",
success: function() {
$.when(photo.fadeOut(400)).then(function(){
photo.fadeOut(400, function() {
photo.remove();
if( self.publisher.$(".publisher_photo").length === 0 ) {
......
......@@ -44,7 +44,7 @@ app.views.Publisher = Backbone.View.extend({
// if there is data in the publisher we ask for a confirmation
// before the user is able to leave the page
$(window).on("beforeunload", _.bind(this._beforeUnload, this));
$(window).unload(this.clear.bind(this));
$(window).on("unload", this.clear.bind(this));
// sync textarea content
if( this.hiddenInputEl.val() === "" ) {
......
......@@ -6,7 +6,7 @@ app.views.Tags = Backbone.View.extend({
app.publisher.setText("#"+ opts.hashtagName + " ");
}
// 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
......@@ -123,14 +123,18 @@ describe('app.Router', function () {
});
describe("gettingStarted", function() {
beforeEach(function() {
spec.content().append($("<div id='hello-there'>"));
});
it("renders app.pages.GettingStarted", function() {
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() {
app.router.navigate("/getting_started/", {trigger: true});
expect(app.page.$el.selector).toEqual("#hello-there");
expect(app.page.$el.is($("#hello-there"))).toBe(true);
});
});
......
......@@ -16,7 +16,7 @@ describe("app.views.PublisherMention", function() {
this.view = new app.views.PublisherMention({ el: "#publisher" });
expect(app.views.SearchBase.prototype.initialize).toHaveBeenCalled();
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].autoselect).toBeTruthy();
expect(call.args[0].remoteRoute).toEqual({url: "/contacts"});
......
......@@ -614,7 +614,7 @@ describe("app.views.Publisher", function() {
});
context('photo removal', function() {
beforeEach(function() {
beforeEach(function(done) {
this.view = new app.views.Publisher();
this.view.wrapperEl.addClass("with_attachments");
this.view.photozoneEl.html(
......@@ -626,6 +626,7 @@ describe("app.views.Publisher", function() {
);
spyOn(jQuery, 'ajax').and.callFake(function(opts) { opts.success(); });
this.view.viewUploader.on("change", done);
this.view.photozoneEl.find(".x").click();
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment