Browse Source

Merge pull request #1293 in VISUAL/fineui from ~WINDY/fineui:master to master

* commit '030a7b734f8a9c06fa7551cd0eef66d2b5e5f08e':
  BI-62919 fix: 年月区间 && 单测
es6
windy 5 years ago
parent
commit
d890c57f84
  1. 2
      src/base/single/button/buttons/button.text.js
  2. 5
      src/base/single/editor/editor.textarea.js
  3. 45
      src/case/loader/__test__/loader.lazy.test.js
  4. 52
      src/case/loader/__test__/loader.list.test.js
  5. 3
      src/css/base/single/editor/editor.css
  6. 2
      src/css/base/single/text.css
  7. 6
      src/less/base/single/editor/editor.textarea.less
  8. 8
      src/widget/yearmonthinterval/yearmonthinterval.js

2
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,

5
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 {

45
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();
});
});

52
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();
});
});
});

3
src/css/base/single/editor/editor.css

@ -17,3 +17,6 @@
line-height: 21px;
border: none;
}
.bi-textarea-editor .textarea-watermark {
max-height: 100%;
}

2
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;
}

6
src/less/base/single/editor/editor.textarea.less

@ -9,9 +9,9 @@
& {
border: none;
}
&.textarea-editor-focus{
}
}
& .textarea-watermark{
max-height: 100%;
}
}

8
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
});
},

Loading…
Cancel
Save