Browse Source

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

* commit '007b00c2c6d0b0afefd1a436b8858bc800e47b70':
  BI-63192 fix: 修复multi_select_list初始化两次itemsCreator的问题
  BI-61182 test: 单测 && 修复virtual_list populate无效的问题
master
windy 5 years ago
parent
commit
80c02cb460
  1. 2
      changelog.md
  2. 2
      src/base/list/virtuallist.js
  3. 5
      src/widget/multiselectlist/multiselectlist.insert.js
  4. 5
      src/widget/multiselectlist/multiselectlist.insert.nobar.js
  5. 5
      src/widget/multiselectlist/multiselectlist.js
  6. 90
      src/widget/timeinterval/__test__/timeinterval.test.js
  7. 44
      src/widget/yearmonthinterval/__test__/yearmonthinterval.test.js

2
changelog.md

@ -1,5 +1,7 @@
# 更新日志 # 更新日志
2.0(2020-04) 2.0(2020-04)
- 修复了复选下拉列表初始化的时候发送执行两次itemsCreator的问题
- 修复了virtual_list重新populate无效的问题
- 复选下拉框新增值的时候外抛事件 - 复选下拉框新增值的时候外抛事件
- 空格不再编码成&nbsp - 空格不再编码成&nbsp
- 支持文本区域水印可滚动 - 支持文本区域水印可滚动

2
src/base/list/virtuallist.js

@ -171,7 +171,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
if (items && this.options.items !== items) { if (items && this.options.items !== items) {
this.restore(); this.restore();
} }
this._populate(); this._populate(items);
}, },
destroyed: function () { destroyed: function () {

5
src/widget/multiselectlist/multiselectlist.insert.js

@ -46,9 +46,12 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
return self.trigger.getKeyword(); return self.trigger.getKeyword();
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
op.keywords = [self.trigger.getKeyword()]; var keyword = self.trigger.getKeyword();
if (BI.isNotEmptyString(keyword)) {
op.keywords = [keyword];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
}
}, },
listeners: [{ listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM, eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,

5
src/widget/multiselectlist/multiselectlist.insert.nobar.js

@ -52,9 +52,12 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
return self.trigger.getKeyword(); return self.trigger.getKeyword();
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
op.keywords = [self.trigger.getKeyword()]; var keyword = self.trigger.getKeyword();
if (BI.isNotEmptyString(keyword)) {
op.keywords = [keyword];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
}
}, },
listeners: [{ listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM, eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,

5
src/widget/multiselectlist/multiselectlist.js

@ -50,10 +50,13 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
return self.trigger.getKeyword(); return self.trigger.getKeyword();
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
op.keywords = [self.trigger.getKeyword()]; var keyword = self.trigger.getKeyword();
if (BI.isNotEmptyString(keyword)) {
op.keywords = [keyword];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
} }
}
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);

90
src/widget/timeinterval/__test__/timeinterval.test.js

@ -11,8 +11,9 @@ describe("DateInterval", function () {
*/ */
it("DateInterval_defaultValue", function () { it("DateInterval_defaultValue", function () {
var dateInterval = BI.Test.createWidget({ var dateInterval = BI.Test.createWidget({
type: "bi.date_interval", type: "bi.date_interval"
value: { });
dateInterval.setValue({
start: { start: {
type: 1, type: 1,
value: { value: {
@ -28,12 +29,53 @@ describe("DateInterval", function () {
position: 2 position: 2
} }
} }
},
}); });
expect(dateInterval.element.find(".bi-date-trigger .bi-label").text()).to.equal("2018-01-122019-01-01"); expect(dateInterval.element.find(".bi-date-trigger .bi-label").text()).to.equal("2018-01-122019-01-01");
dateInterval.destroy(); dateInterval.destroy();
}); });
/**
* test_author_windy
*/
it("DateInterval_测试报错", function (done) {
var testText;
var dateInterval = BI.Test.createWidget({
type: "bi.date_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-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);
})
});
/** /**
* test_author_windy * test_author_windy
*/ */
@ -98,4 +140,46 @@ describe("DateInterval", function () {
}); });
dateInterval.destroy(); 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);
})
});
}); });

44
src/widget/yearmonthinterval/__test__/yearmonthinterval.test.js

@ -60,7 +60,7 @@ describe("YearMonthInterval", function () {
*/ */
it("setValue", function () { it("setValue", function () {
var dateCombo = BI.Test.createWidget({ var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo", type: "bi.year_month_interval",
width: 220, width: 220,
height: 30 height: 30
}); });
@ -99,4 +99,46 @@ describe("YearMonthInterval", function () {
dateCombo.destroy(); 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);
});
}); });
Loading…
Cancel
Save