From 36a97fc7f7a9002a35f0b68e21a6e5a88646bd81 Mon Sep 17 00:00:00 2001 From: Kendo Bot Date: Wed, 21 Feb 2018 04:59:15 +0200 Subject: [PATCH] Sync with Kendo UI Professional --- src/kendo.dialog.js | 58 ++++++++---------------------------------- tests/dialog/api.js | 61 --------------------------------------------- 2 files changed, 10 insertions(+), 109 deletions(-) diff --git a/src/kendo.dialog.js b/src/kendo.dialog.js index bb9b2898d88..b426417e5a7 100644 --- a/src/kendo.dialog.js +++ b/src/kendo.dialog.js @@ -124,33 +124,6 @@ } }, - setOptions: function(options) { - var that = this; - - Widget.fn.setOptions.call(that, options); - - if (options.content) { - kendo.destroy(that.element.children()); - that.element.html(options.content); - } - - if (options.actions) { - that.wrapper.children(KBUTTONGROUP).remove(); - that._createActionbar(that.wrapper); - } - - that._closable(that.wrapper); - that._dimensions(); - - if (options.modal !== undefined) { - that._overlay(that.wrapper.is(VISIBLE)).css({ opacity: 0.5 }); - } - - if (options.title !== undefined) { - that.title(options.title); - } - }, - _dimensions: function() { var that = this, wrapper = that.wrapper, @@ -321,6 +294,7 @@ options = that.options, isRtl = kendo.support.isRtl(content), titlebar = $(templates.titlebar(options)), + titlebarActions = titlebar.find(".k-window-actions"), titleId = (content.id || kendo.guid()) + "_title", wrapper = $(that.wrapperTemplate(options)); @@ -329,6 +303,15 @@ content.addClass(KCONTENTCLASS); that.appendTo.append(wrapper); + if (options.closable !== false) { + if (options.title !== false) { + titlebarActions.append(templates.close(options)); + } + else { + wrapper.append(templates.close(options)); + } + } + if (options.title !== false) { wrapper.append(titlebar); titlebar.attr("id", titleId); @@ -337,8 +320,6 @@ wrapper.addClass(KTITLELESS); } - that._closable(wrapper); - wrapper.append(content); if (options.content) { @@ -351,25 +332,6 @@ } }, - _closable: function (wrapper) { - var that = this; - var options = that.options; - var titlebar = wrapper.children(KDIALOGTITLEBAR); - var titlebarActions = titlebar.find(".k-window-actions"); - var closeAction = titlebarActions.length ? titlebarActions.find(".k-dialog-close") : wrapper.find(".k-dialog-close"); - - closeAction.remove(); - - if (options.closable !== false) { - if (options.title !== false) { - titlebarActions.append(templates.close(options)); - } - else { - wrapper.prepend(templates.close(options)); - } - } - }, - _createActionbar: function(wrapper) { var isStretchedLayout = (this.options.buttonLayout === "stretched"); var buttonLayout = isStretchedLayout ? "stretched" : "normal"; diff --git a/tests/dialog/api.js b/tests/dialog/api.js index b1adad68855..ba980c3aa73 100644 --- a/tests/dialog/api.js +++ b/tests/dialog/api.js @@ -312,67 +312,6 @@ ok(dialog.wrapper.is(":visible")); }); - test("setOptions modifies actions", function() { - var dialog = createDialog({ - actions: [{ - text: "OK" - }] - }); - - dialog.setOptions({ - actions:[ - { text: "OK" }, - { text: "Cancel" } - ] - }); - - equal(dialog.wrapper.find(".k-dialog-buttongroup .k-button").length, 2); - }); - - test("setOptions modifies title", function() { - var dialog = createDialog({ - actions: [{ - text: "OK" - }] - }); - - dialog.setOptions({ - title: "Test" - }); - - equal(dialog.title(), "Test"); - }); - - test("setOptions modifies modality", function() { - var dialog = createDialog({ - actions: [{ - text: "OK" - }], - modal: true - }); - - dialog.setOptions({ - modal: false - }); - - equal(dialog.options.modal, false); - }); - - test("setOptions modifies modality", function() { - var dialog = createDialog({ - actions: [{ - text: "OK" - }], - modal: true - }); - - dialog.setOptions({ - content: "test" - }); - - equal(dialog.element.html(), "test"); - }); - test("center should track for resize", function() { var dialog = createDialog({ visible: false }); trackMethodCall(dialog, "_centerOnResize");