diff --git a/changelog.md b/changelog.md index fe1e30a8a..10554c938 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ # 更新日志 2.0(2020-04) +- 修复了复选下拉列表初始化的时候发送执行两次itemsCreator的问题 +- 修复了virtual_list重新populate无效的问题 - 复选下拉框新增值的时候外抛事件 - 空格不再编码成  - 支持文本区域水印可滚动 diff --git a/src/base/list/virtuallist.js b/src/base/list/virtuallist.js index e5d996bcd..3eb51ab64 100644 --- a/src/base/list/virtuallist.js +++ b/src/base/list/virtuallist.js @@ -171,7 +171,7 @@ BI.VirtualList = BI.inherit(BI.Widget, { if (items && this.options.items !== items) { this.restore(); } - this._populate(); + this._populate(items); }, destroyed: function () { diff --git a/src/widget/timeinterval/__test__/timeinterval.test.js b/src/widget/timeinterval/__test__/timeinterval.test.js index 4ab9225a1..808c14547 100644 --- a/src/widget/timeinterval/__test__/timeinterval.test.js +++ b/src/widget/timeinterval/__test__/timeinterval.test.js @@ -10,28 +10,70 @@ describe("DateInterval", function () { * test_author_windy */ it("DateInterval_defaultValue", function () { + var dateInterval = BI.Test.createWidget({ + type: "bi.date_interval" + }); + dateInterval.setValue({ + start: { + type: 1, + value: { + year: 2018, + month: 1, + day: 12 + } + }, + end: { + type: 2, + value: { + year: -1, + position: 2 + } + } + }); + expect(dateInterval.element.find(".bi-date-trigger .bi-label").text()).to.equal("2018-01-122019-01-01"); + dateInterval.destroy(); + }); + + /** + * test_author_windy + */ + it("DateInterval_测试报错", function (done) { + var testText; var dateInterval = BI.Test.createWidget({ type: "bi.date_interval", value: { start: { - type: 1, + type: 2, value: { - year: 2018, - month: 1, - day: 12 + year: -1, + position: 2 } }, end: { - type: 2, + type: 1, value: { - year: -1, - position: 2 + year: 2018, + month: 1, + day: 12 } } }, + listeners: [{ + eventName: "EVENT_ERROR", + action: function () { + testText = "ERROR"; + } + }] }); - expect(dateInterval.element.find(".bi-date-trigger .bi-label").text()).to.equal("2018-01-122019-01-01"); - dateInterval.destroy(); + BI.nextTick(function () { + dateInterval.element.find(".first-element .bi-date-trigger .bi-basic-button").click(); + BI.delay(function () { + dateInterval.element.find(".first-element .bi-text-button:contains(确定)").click(); + expect(testText).to.equal("ERROR"); + dateInterval.destroy(); + done(); + }, 300); + }) }); /** @@ -98,4 +140,46 @@ describe("DateInterval", function () { }); dateInterval.destroy(); }); + + /** + * test_author_windy + */ + it("TimeInterval_测试报错", function (done) { + var testText; + var dateInterval = BI.Test.createWidget({ + type: "bi.time_interval", + value: { + start: { + type: 2, + value: { + year: -1, + position: 2 + } + }, + end: { + type: 1, + value: { + year: 2018, + month: 1, + day: 12 + } + } + }, + listeners: [{ + eventName: "EVENT_ERROR", + action: function () { + testText = "ERROR"; + } + }] + }); + BI.nextTick(function () { + dateInterval.element.find(".first-element .bi-date-time-trigger .bi-basic-button").click(); + BI.delay(function () { + dateInterval.element.find(".first-element .bi-text-button:contains(确定)").click(); + expect(testText).to.equal("ERROR"); + dateInterval.destroy(); + done(); + }, 300); + }) + }); }); \ No newline at end of file diff --git a/src/widget/yearmonthinterval/__test__/yearmonthinterval.test.js b/src/widget/yearmonthinterval/__test__/yearmonthinterval.test.js index 7e116f3af..fd8092caf 100644 --- a/src/widget/yearmonthinterval/__test__/yearmonthinterval.test.js +++ b/src/widget/yearmonthinterval/__test__/yearmonthinterval.test.js @@ -60,7 +60,7 @@ describe("YearMonthInterval", function () { */ it("setValue", function () { var dateCombo = BI.Test.createWidget({ - type: "bi.dynamic_year_month_combo", + type: "bi.year_month_interval", width: 220, height: 30 }); @@ -99,4 +99,46 @@ describe("YearMonthInterval", function () { dateCombo.destroy(); }); + + /** + * test_author_windy + */ + it("错误提示", function (done) { + var testText; + var dateCombo = BI.Test.createWidget({ + type: "bi.year_month_interval", + width: 220, + height: 30, + value: { + start: { + type: 2, + value: { + year: -1, + month: 1 + } + }, + end: { + type: 1, + value: { + year: 2018, + month: 1 + } + } + }, + listeners: [{ + eventName: "EVENT_ERROR", + action: function () { + testText = "ERROR" + } + }] + }); + dateCombo.element.find(".first-element .pull-down-font").click(); + BI.delay(function () { + dateCombo.element.find(".bi-text-button:contains(确定)").click(); + expect(testText).to.equal("ERROR"); + dateCombo.destroy(); + done(); + }, 300); + + }); }); \ No newline at end of file