diff --git a/src/base/single/__test__/text.test.js b/src/base/single/__test__/text.test.js index a2a774d2a..0aa659ac6 100644 --- a/src/base/single/__test__/text.test.js +++ b/src/base/single/__test__/text.test.js @@ -117,7 +117,7 @@ describe("TextTest", function () { type: "bi.text", text: "我是要标红的 A", }); - expect(text.element.text()).to.equal("我是要标红的 A"); + expect(text.element.text()).to.equal("我是要标红的 A"); text.destroy(); }); diff --git a/src/case/loader/__test__/loader.lazy.test.js b/src/case/loader/__test__/loader.lazy.test.js new file mode 100644 index 000000000..7f8f8205f --- /dev/null +++ b/src/case/loader/__test__/loader.lazy.test.js @@ -0,0 +1,49 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2020/4/3 + */ + +describe("lazy_loader", function () { + + /** + * test_author_windy + **/ + it("setValue", function () { + var items = BI.map(BI.range(0, 100), function (idx, v) { + return { + type: "bi.single_select_item", + text: v, + value: v + } + }); + var widget = BI.Test.createWidget({ + type: "bi.lazy_loader", + el: { + layouts: [{ + type: "bi.left", + hgap: 5 + }] + } + }); + widget.populate(items); + expect(widget.getAllButtons().length).to.equal(100); + widget.addItems([{ + type: "bi.single_select_item", + text: 102, + value: 102 + }, { + type: "bi.single_select_item", + text: 103, + value: 103 + }]); + expect(widget.getAllLeaves().length).to.equal(102); + widget.setValue(102); + expect(widget.getValue()[0]).to.equal(102); + expect(widget.getSelectedButtons().length).to.equal(1); + widget.setNotSelectedValue(102); + expect(widget.getNotSelectedValue()[0]).to.equal(102); + expect(widget.getNotSelectedButtons().length).to.equal(1); + widget.destroy(); + }); +}); \ No newline at end of file diff --git a/src/case/loader/loader.lazy.js b/src/case/loader/loader.lazy.js index 509641148..339940077 100644 --- a/src/case/loader/loader.lazy.js +++ b/src/case/loader/loader.lazy.js @@ -8,7 +8,8 @@ BI.LazyLoader = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.LazyLoader.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-lazy-loader", - el: {} + el: {}, + items: [] }); }, diff --git a/src/core/__test__/alias.test.js b/src/core/__test__/alias.test.js index d2b18b6ab..51297986d 100644 --- a/src/core/__test__/alias.test.js +++ b/src/core/__test__/alias.test.js @@ -18,7 +18,7 @@ describe("aliasFunctionTest", function () { var targetString = "1 2&"; var encodeString = BI.htmlEncode(targetString); - expect(encodeString).to.equal("<a>1 2&</a>"); + expect(encodeString).to.equal("<a>1 2&</a>"); expect(BI.htmlDecode(encodeString)).to.equal(targetString); }); diff --git a/src/widget/datetime/__test__/datetime.test.js b/src/widget/datetime/__test__/datetime.test.js index 091419604..ac01dc2c9 100644 --- a/src/widget/datetime/__test__/datetime.test.js +++ b/src/widget/datetime/__test__/datetime.test.js @@ -28,7 +28,7 @@ describe("DateTime", function () { second: 12 } }); - expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12"); + expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12"); dateCombo.destroy(); }); @@ -51,7 +51,7 @@ describe("DateTime", function () { BI.nextTick(function () { dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(16)").parent().click(); dateCombo.element.find(".bi-date-time-popup .bi-text:contains(确定)").parent().click(); - expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-16 12:12:12"); + expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-16 12:12:12"); dateCombo.destroy(); done(); }) @@ -77,7 +77,7 @@ describe("DateTime", function () { BI.nextTick(function () { dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(16)").parent().click(); dateCombo.element.find(".bi-date-time-popup .bi-text:contains(取消)").parent().click(); - expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12"); + expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12"); dateCombo.destroy(); done(); }) diff --git a/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js b/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js index a11918655..acfc0ac52 100644 --- a/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js +++ b/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js @@ -32,7 +32,7 @@ describe("DateTimeCombo", function () { } }); BI.nextTick(function () { - expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12"); + expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12"); dateCombo.destroy(); done(); }) @@ -318,7 +318,7 @@ describe("DateTimeCombo", function () { input.val("2017-1-1"); BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), null, BI.KeyCode.ENTER, function () { BI.delay(function () { - expect(dateCombo.element.find(".bi-date-time-trigger .bi-text-button").text()).to.equal("2017-01-01 00:00:00"); + expect(dateCombo.element.find(".bi-date-time-trigger .bi-text-button").text()).to.equal("2017-01-01 00:00:00"); dateCombo.destroy(); done(); }, 300); diff --git a/src/widget/timeinterval/__test__/timeinterval.test.js b/src/widget/timeinterval/__test__/timeinterval.test.js index c93714c53..4ab9225a1 100644 --- a/src/widget/timeinterval/__test__/timeinterval.test.js +++ b/src/widget/timeinterval/__test__/timeinterval.test.js @@ -61,7 +61,7 @@ describe("DateInterval", function () { } }, }); - expect(dateInterval.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-01-12 10:10:102019-01-01 00:00:00"); + expect(dateInterval.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-01-12 10:10:102019-01-01 00:00:00"); dateInterval.destroy(); });