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. 9
      src/widget/multiselectlist/multiselectlist.insert.js
  4. 9
      src/widget/multiselectlist/multiselectlist.insert.nobar.js
  5. 9
      src/widget/multiselectlist/multiselectlist.js
  6. 102
      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)
- 修复了复选下拉列表初始化的时候发送执行两次itemsCreator的问题
- 修复了virtual_list重新populate无效的问题
- 复选下拉框新增值的时候外抛事件
- 空格不再编码成&nbsp
- 支持文本区域水印可滚动

2
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 () {

9
src/widget/multiselectlist/multiselectlist.insert.js

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

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

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

9
src/widget/multiselectlist/multiselectlist.js

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

102
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);
})
});
});

44
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);
});
});
Loading…
Cancel
Save