From 7cd74b998d5f38d4eea30b4d3305fc7ca589ec4b Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 5 Sep 2019 19:47:06 +0800 Subject: [PATCH] =?UTF-8?q?BI-51100=20=E5=8D=95=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo.multilayer_single_tree_combo.js | 10 +- dist/2.0/fineui.ie.js | 2 +- dist/2.0/fineui.js | 2 +- dist/bundle.ie.js | 2 +- dist/bundle.js | 2 +- dist/demo.js | 10 +- dist/fineui.ie.js | 2 +- dist/fineui.js | 2 +- dist/fineui_without_jquery_polyfill.js | 2 +- dist/widget.js | 2 +- .../__test__/dynamicdate.combo.test.js | 111 ++++++++++++++++-- 11 files changed, 130 insertions(+), 17 deletions(-) diff --git a/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js b/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js index 109d0c489..466f1484d 100644 --- a/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js +++ b/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js @@ -16,8 +16,16 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + allowEdit: true, text: "默认值", - items: items, + itemsCreator: function() { + return { + items: [{ + value: 1 + }], + hasNext: false + } + }, width: 300 }, { type: "bi.button", diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 4270cea0e..f2c7d0c9b 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -66206,7 +66206,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 0e0ce3b38..88bf428cb 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -66610,7 +66610,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 4270cea0e..f2c7d0c9b 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -66206,7 +66206,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/bundle.js b/dist/bundle.js index 0e0ce3b38..88bf428cb 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -66610,7 +66610,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/demo.js b/dist/demo.js index 543d484b6..24af8bc04 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -10586,8 +10586,16 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + allowEdit: true, text: "默认值", - items: items, + itemsCreator: function() { + return { + items: [{ + value: 1 + }], + hasNext: false + } + }, width: 300 }, { type: "bi.button", diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 5230e323e..4fb5de0f1 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -66451,7 +66451,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/fineui.js b/dist/fineui.js index d986a75d8..23dd71f5e 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -66855,7 +66855,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 80ff9b32d..a56d0b091 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -49154,7 +49154,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/dist/widget.js b/dist/widget.js index 40fa95498..225f143e3 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -4264,7 +4264,7 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat }, { eventName: BI.SignEditor.EVENT_CHANGE, action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.MINUTE); + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.MINUTE); this.setValue(value); } }], diff --git a/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js b/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js index 60804a89a..c90c0c295 100644 --- a/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js +++ b/src/widget/dynamicdate/__test__/dynamicdate.combo.test.js @@ -89,20 +89,117 @@ describe("DateCombo", function () { var dateCombo = BI.Test.createWidget({ type: "bi.dynamic_date_combo", width: 220, - height: 30 + height: 30, }); // 点击日期,是否收起下拉 + BI.nextTick(function () { + dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); + BI.nextTick(function () { + var input = dateCombo.element.find(".bi-date-trigger .bi-input"); + BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () { + BI.delay(function () { + expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).to.equal("none"); + dateCombo.destroy(); + done(); + }, 300); + }); + }) + }); + }); + + + /** + * test_author_windy + */ + it("点击清空", function (done) { + var dateCombo = BI.Test.createWidget({ + type: "bi.dynamic_date_combo", + width: 220, + height: 30, + value: { + type: 1, + value: { + year: 2018, + month: 2, + day: 23 + } + } + }); dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); BI.nextTick(function () { - BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), null, BI.KeyCode.ENTER, function () { - BI.delay(function () { - expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).to.equal("none"); - dateCombo.destroy(); - done(); - }, 300); + dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(清除)").parent().click(); + expect(BI.isNull(dateCombo.getValue())).to.equal(true); + dateCombo.destroy(); + done(); + }) + }); + + /** + * test_author_windy + */ + it("点击今天", function (done) { + var dateCombo = BI.Test.createWidget({ + type: "bi.dynamic_date_combo", + width: 220, + height: 30, + value: { + type: 1, + value: { + year: 2018, + month: 2, + day: 23 + } + } + }); + dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); + BI.nextTick(function () { + dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(今天)").parent().click(); + var date = BI.getDate(); + expect(dateCombo.getValue()).to.equal({ + type: 1, + value: { + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate() + } }); + dateCombo.destroy(); + done(); }) + }); + + /** + * test_author_windy + */ + it("点击确定", function (done) { + var dateCombo = BI.Test.createWidget({ + type: "bi.dynamic_date_combo", + width: 220, + height: 30, + value: { + type: 1, + value: { + year: 2018, + month: 2, + day: 23 + } + } + }); + dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); + BI.nextTick(function () { + dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(确定)").parent().click(); + expect(dateCombo.getValue()).to.deep.equal({ + type: 1, + value: { + year: 2018, + month: 2, + day: 23 + } + }); + dateCombo.destroy(); + done(); + }) });