Browse Source

REPORT-28558 fix: 修复了连续多次调用BI.Msg.alert后只有最后弹出的可以关闭的问题 && 单测

es6
windy 5 years ago
parent
commit
d69064aecc
  1. 1
      changelog.md
  2. 16
      src/base/foundation/message.js
  3. 41
      src/base/grid/__test__/grid.test.js
  4. 21
      src/case/colorchooser/farbtastic/__test__/farbtastic.test.js
  5. 16
      src/case/pager/__test__/pager.test.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2020-03) 2.0(2020-03)
- 修复了连续多次调用BI.Msg.alert后只有最后弹出的可以关闭的问题
- 修复了time_combo设置格式为%M:%S后value设置大于30分钟的值时标红的问题 - 修复了time_combo设置格式为%M:%S后value设置大于30分钟的值时标红的问题
- 复选下拉树系列展开节点性能优化 - 复选下拉树系列展开节点性能优化

16
src/base/foundation/message.js

@ -5,7 +5,9 @@
*/ */
BI.Msg = function () { BI.Msg = function () {
var messageShow, $mask, $pop; var $mask, $pop;
var messageShows = [];
var toastStack = []; var toastStack = [];
@ -67,7 +69,7 @@ BI.Msg = function () {
}, 5000); }, 5000);
}, },
_show: function (hasCancel, title, message, callback) { _show: function (hasCancel, title, message, callback) {
$mask = BI.Widget._renderEngine.createElement("<div class=\"bi-z-index-mask\">").css({ BI.isNull($mask) && ($mask = BI.Widget._renderEngine.createElement("<div class=\"bi-z-index-mask\">").css({
position: "absolute", position: "absolute",
zIndex: BI.zIndex_tip - 2, zIndex: BI.zIndex_tip - 2,
top: 0, top: 0,
@ -75,7 +77,7 @@ BI.Msg = function () {
right: 0, right: 0,
bottom: 0, bottom: 0,
opacity: 0.5 opacity: 0.5
}).appendTo("body"); }).appendTo("body"));
$pop = BI.Widget._renderEngine.createElement("<div class=\"bi-message-depend\">").css({ $pop = BI.Widget._renderEngine.createElement("<div class=\"bi-message-depend\">").css({
position: "absolute", position: "absolute",
zIndex: BI.zIndex_tip - 1, zIndex: BI.zIndex_tip - 1,
@ -85,8 +87,12 @@ BI.Msg = function () {
bottom: 0 bottom: 0
}).appendTo("body"); }).appendTo("body");
var close = function () { var close = function () {
messageShow.destroy(); messageShows[messageShows.length - 1].destroy();
messageShows.pop();
if (messageShows.length === 0) {
$mask.remove(); $mask.remove();
$mask = null;
}
}; };
var controlItems = []; var controlItems = [];
if (hasCancel === true) { if (hasCancel === true) {
@ -191,7 +197,7 @@ BI.Msg = function () {
] ]
}; };
messageShow = BI.createWidget(conf); messageShows[messageShows.length] = BI.createWidget(conf);
} }
}; };
}(); }();

41
src/base/grid/__test__/grid.test.js

@ -0,0 +1,41 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/3/20
*/
describe("GridTest", function () {
/**
* test_author_windy
*/
it("grid", function () {
var items = [];
var rowCount = 1000, columnCount = 100;
for (var i = 0; i < rowCount; i++) {
items[i] = [];
for (var j = 0; j < columnCount; j++) {
items[i][j] = {
type: "bi.label",
text: i + "-" + j
};
}
}
var grid = BI.createWidget({
type: "bi.grid_view",
width: 400,
height: 300,
estimatedRowSize: 30,
estimatedColumnSize: 100,
items: items,
scrollTop: 100,
rowHeightGetter: function () {
return 30;
},
columnWidthGetter: function () {
return 100;
}
});
// TODO 性能展示类控件,不知道要测啥,标记一下
grid.destroy();
});
});

21
src/case/colorchooser/farbtastic/__test__/farbtastic.test.js

@ -0,0 +1,21 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/3/20
*/
describe("FarbtasticTest", function () {
/**
* test_author_windy
*/
it("Farbtastic", function () {
var a = BI.Test.createWidget({
type: "bi.farbtastic",
height: 200,
width: 200
});
a.setValue("#d56c6c");
expect(a.getValue()).to.equal("#d56c6c");
a.destroy();
});
});

16
src/case/pager/__test__/pager.test.js

@ -78,4 +78,20 @@ describe("PagerTest", function () {
a.clear(); a.clear();
a.destroy(); a.destroy();
}); });
/**
* test_author_windy
*/
it("detail_Pager", function () {
var a = BI.Test.createWidget({
type: "bi.detail_pager",
pages: 100
});
a.setAllPages(200);
a.populate();
a.setValue(200);
expect(a.hasPrev(200)).to.equal(true);
expect(a.hasNext(200)).to.equal(false);
a.destroy();
});
}); });
Loading…
Cancel
Save