From 030a7b734f8a9c06fa7551cd0eef66d2b5e5f08e Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 8 Apr 2020 14:53:17 +0800 Subject: [PATCH] =?UTF-8?q?BI-62919=20fix:=20=E5=B9=B4=E6=9C=88=E5=8C=BA?= =?UTF-8?q?=E9=97=B4=20&&=20=E5=8D=95=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/button/buttons/button.text.js | 2 + src/base/single/editor/editor.textarea.js | 5 +- src/case/loader/__test__/loader.lazy.test.js | 45 ++++++++-------- src/case/loader/__test__/loader.list.test.js | 52 +++++++++++++++++++ src/css/base/single/editor/editor.css | 3 ++ src/css/base/single/text.css | 2 +- .../base/single/editor/editor.textarea.less | 6 +-- .../yearmonthinterval/yearmonthinterval.js | 8 +-- 8 files changed, 91 insertions(+), 32 deletions(-) create mode 100644 src/case/loader/__test__/loader.list.test.js diff --git a/src/base/single/button/buttons/button.text.js b/src/base/single/button/buttons/button.text.js index abb782ee9..6c8cf9b7c 100644 --- a/src/base/single/button/buttons/button.text.js +++ b/src/base/single/button/buttons/button.text.js @@ -17,6 +17,7 @@ BI.TextButton = BI.inherit(BI.BasicButton, { hgap: 0, lgap: 0, rgap: 0, + vgap: 0, text: "", py: "" }); @@ -35,6 +36,7 @@ BI.TextButton = BI.inherit(BI.BasicButton, { width: o.width, height: o.height, hgap: o.hgap, + vgap: o.vgap, lgap: o.lgap, rgap: o.rgap, text: o.text, diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index e91f9df4a..9b50d8556 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -81,7 +81,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { if (!this.watermark) { this.watermark = BI.createWidget({ type: "bi.text_button", - cls: "bi-water-mark cursor-default", + cls: "bi-water-mark cursor-default textarea-watermark", textAlign: "left", whiteSpace: "normal", text: o.watermark, @@ -100,8 +100,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { el: this.watermark, left: 0, top: 0, - right: 0, - bottom: 0 + right: 0 }] }); } else { diff --git a/src/case/loader/__test__/loader.lazy.test.js b/src/case/loader/__test__/loader.lazy.test.js index 7f8f8205f..8b0ae15a1 100644 --- a/src/case/loader/__test__/loader.lazy.test.js +++ b/src/case/loader/__test__/loader.lazy.test.js @@ -9,7 +9,7 @@ describe("lazy_loader", function () { /** * test_author_windy **/ - it("setValue", function () { + it("setValue", function (done) { var items = BI.map(BI.range(0, 100), function (idx, v) { return { type: "bi.single_select_item", @@ -24,26 +24,29 @@ describe("lazy_loader", function () { type: "bi.left", hgap: 5 }] - } + }, + items: items + }); + BI.nextTick(function () { + 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(); + done(); }); - 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/__test__/loader.list.test.js b/src/case/loader/__test__/loader.list.test.js new file mode 100644 index 000000000..cad5f510d --- /dev/null +++ b/src/case/loader/__test__/loader.list.test.js @@ -0,0 +1,52 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2020/4/3 + */ + +describe("list_loader", function () { + + /** + * test_author_windy + **/ + it("setValue", function (done) { + 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.list_loader", + el: { + layouts: [{ + type: "bi.left", + hgap: 5 + }] + }, + items: items + }); + BI.nextTick(function () { + 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(); + done(); + }); + }); +}); \ No newline at end of file diff --git a/src/css/base/single/editor/editor.css b/src/css/base/single/editor/editor.css index 39f14dde9..aba2d63bb 100644 --- a/src/css/base/single/editor/editor.css +++ b/src/css/base/single/editor/editor.css @@ -17,3 +17,6 @@ line-height: 21px; border: none; } +.bi-textarea-editor .textarea-watermark { + max-height: 100%; +} diff --git a/src/css/base/single/text.css b/src/css/base/single/text.css index 16ad7cf45..ade369b5c 100644 --- a/src/css/base/single/text.css +++ b/src/css/base/single/text.css @@ -10,5 +10,5 @@ /*IE8*/ box-sizing: border-box; /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ - word-break: break-word; + word-break: break-all; } diff --git a/src/less/base/single/editor/editor.textarea.less b/src/less/base/single/editor/editor.textarea.less index ccfd09cfe..159e8aa5f 100644 --- a/src/less/base/single/editor/editor.textarea.less +++ b/src/less/base/single/editor/editor.textarea.less @@ -9,9 +9,9 @@ & { border: none; } - &.textarea-editor-focus{ - - } + } + & .textarea-watermark{ + max-height: 100%; } } diff --git a/src/widget/yearmonthinterval/yearmonthinterval.js b/src/widget/yearmonthinterval/yearmonthinterval.js index 34fb68fa4..835cbc5e8 100644 --- a/src/widget/yearmonthinterval/yearmonthinterval.js +++ b/src/widget/yearmonthinterval/yearmonthinterval.js @@ -135,13 +135,13 @@ BI.YearMonthInterval = BI.inherit(BI.Single, { bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); } - return this._dateCheck(smallDate4Check) && BI.checkDateLegal(smallDate) && this._checkVoid({ + return this._dateCheck(smallDate4Check) && BI.checkDateLegal(smallDate4Check) && this._checkVoid({ year: smallObj[0], - month: smallObj[1], + month: smallObj[1] || 1, day: 1 - }) && this._dateCheck(bigDate4Check) && BI.checkDateLegal(bigDate) && this._checkVoid({ + }) && this._dateCheck(bigDate4Check) && BI.checkDateLegal(bigDate4Check) && this._checkVoid({ year: bigObj[0], - month: bigObj[1], + month: bigObj[1] || 1, day: 1 }); },