don't use the deprecated ".selector" method
This commit is contained in:
parent
a479db1c96
commit
f36a4cd1f5
4 changed files with 27 additions and 15 deletions
|
|
@ -41,18 +41,23 @@ describe("app", function() {
|
|||
});
|
||||
|
||||
describe("setupForms", function() {
|
||||
beforeEach(function() {
|
||||
spec.content().append("<textarea/> <input/>");
|
||||
});
|
||||
|
||||
it("calls jQuery.placeholder() for inputs", function() {
|
||||
spyOn($.fn, "placeholder");
|
||||
app.setupForms();
|
||||
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(){
|
||||
spyOn(window, "autosize");
|
||||
app.setupForms();
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ describe("app.views.Search", function() {
|
|||
spyOn(app.views.SearchBase.prototype, "initialize");
|
||||
this.view = new app.views.Search({el: "#search_people_form"});
|
||||
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"});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -119,42 +119,49 @@ describe("app.views.Base", function(){
|
|||
|
||||
context("calling out to third party plugins", function() {
|
||||
it("replaces .time with relative time ago in words", function() {
|
||||
this.view.templateName = false;
|
||||
spyOn($.fn, "timeago");
|
||||
this.view.$el.append("<time/>");
|
||||
this.view.render();
|
||||
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(){
|
||||
this.view.templateName = false;
|
||||
this.view.tooltipSelector = ".christopher_columbus, .barrack_obama, .block_user";
|
||||
this.view.$el.append("<div class='christopher_columbus barrack_obama block_user'/>");
|
||||
|
||||
spyOn($.fn, "tooltip");
|
||||
this.view.render();
|
||||
expect($.fn.tooltip.calls.mostRecent().object.selector).toBe(".christopher_columbus, .barrack_obama, .block_user");
|
||||
});
|
||||
|
||||
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");
|
||||
expect(
|
||||
$.fn.tooltip.calls.mostRecent().object.is(".christopher_columbus, .barrack_obama, .block_user")
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
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() {
|
||||
spyOn($.fn, "placeholder");
|
||||
this.view.renderTemplate();
|
||||
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(){
|
||||
spyOn(window, "autosize");
|
||||
this.view.renderTemplate();
|
||||
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(){
|
||||
Diaspora.Mobile.initialize();
|
||||
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(){
|
||||
|
|
|
|||
Loading…
Reference in a new issue