Permalink
Browse files

Revert "Add onRendered callback as a dialog option. Add appropriate t…

…ests"

This reverts commit 151bc5c.
  • Loading branch information...
1 parent 3766cad commit 5e1cf59510170cf7c44bb6d93d20842fedc6f8d0 @makeusabrew committed Sep 29, 2016
Showing with 2 additions and 35 deletions.
  1. +2 −13 bootbox.js
  2. +0 −22 tests/dialog.test.js
View
@@ -584,8 +584,7 @@
var buttons = options.buttons;
var buttonStr = "";
var callbacks = {
- onEscape: options.onEscape,
- onRendered: options.onRendered
+ onEscape: options.onEscape
};
if ($.fn.modal === undefined) {
@@ -677,17 +676,7 @@
});
*/
- dialog.one("shown.bs.modal", function(e) {
- if (callbacks.onRendered) {
- // We do not want to send this callback through processCallback
- // because by default processCallback wants to hide the dialog.
- // This is mentioned because the method name is ambigous and
- // might be better named processOnEscapeCallback. Its core
- // functionality seems to have only been intended for closing the
- // dialog after button clicks or close events.
- callbacks.onRendered.call(dialog, e);
- }
-
+ dialog.one("shown.bs.modal", function() {
dialog.find(".btn-primary:first").focus();
});
View
@@ -412,28 +412,6 @@ describe("bootbox.dialog", function() {
});
});
});
- describe("when creating a dialog with an onRendered handler", function() {
- return describe("with a simple callback", function() {
- beforeEach(function() {
- this.callback = sinon.spy();
- return this.dialog = bootbox.dialog({
- message: "Are you sure?",
- onRendered: this.callback
- });
- });
- return describe("when the dialog is rendered", function() {
- beforeEach(function() {
- return this.dialog.trigger("shown.bs.modal");
- });
- it("should invoke the callback", function() {
- return expect(this.callback).to.have.been.called;
- });
- return it("should pass the dialog as `this`", function() {
- return expect(this.callback.thisValues[0]).to.equal(this.dialog);
- });
- });
- });
- });
return describe("with size option", function() {
describe("when the size option is set to large", function() {
beforeEach(function() {

0 comments on commit 5e1cf59

Please sign in to comment.