diff --git a/changelog.md b/changelog.md index 5f35acd18..0116c51ab 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-03) +- 修复了连续多次调用BI.Msg.alert后只有最后弹出的可以关闭的问题 - 修复了time_combo设置格式为%M:%S后value设置大于30分钟的值时标红的问题 - 复选下拉树系列展开节点性能优化 diff --git a/src/base/foundation/message.js b/src/base/foundation/message.js index 8dbbca146..c2a96e0cc 100644 --- a/src/base/foundation/message.js +++ b/src/base/foundation/message.js @@ -5,7 +5,9 @@ */ BI.Msg = function () { - var messageShow, $mask, $pop; + var $mask, $pop; + + var messageShows = []; var toastStack = []; @@ -67,7 +69,7 @@ BI.Msg = function () { }, 5000); }, _show: function (hasCancel, title, message, callback) { - $mask = BI.Widget._renderEngine.createElement("
").css({ + BI.isNull($mask) && ($mask = BI.Widget._renderEngine.createElement("
").css({ position: "absolute", zIndex: BI.zIndex_tip - 2, top: 0, @@ -75,7 +77,7 @@ BI.Msg = function () { right: 0, bottom: 0, opacity: 0.5 - }).appendTo("body"); + }).appendTo("body")); $pop = BI.Widget._renderEngine.createElement("
").css({ position: "absolute", zIndex: BI.zIndex_tip - 1, @@ -85,8 +87,12 @@ BI.Msg = function () { bottom: 0 }).appendTo("body"); var close = function () { - messageShow.destroy(); - $mask.remove(); + messageShows[messageShows.length - 1].destroy(); + messageShows.pop(); + if (messageShows.length === 0) { + $mask.remove(); + $mask = null; + } }; var controlItems = []; if (hasCancel === true) { @@ -191,7 +197,7 @@ BI.Msg = function () { ] }; - messageShow = BI.createWidget(conf); + messageShows[messageShows.length] = BI.createWidget(conf); } }; }(); \ No newline at end of file diff --git a/src/base/grid/__test__/grid.test.js b/src/base/grid/__test__/grid.test.js new file mode 100644 index 000000000..d65c3d24c --- /dev/null +++ b/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(); + }); +}); \ No newline at end of file diff --git a/src/case/colorchooser/farbtastic/__test__/farbtastic.test.js b/src/case/colorchooser/farbtastic/__test__/farbtastic.test.js new file mode 100644 index 000000000..b3703d908 --- /dev/null +++ b/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(); + }); +}); \ No newline at end of file diff --git a/src/case/pager/__test__/pager.test.js b/src/case/pager/__test__/pager.test.js index 257e79272..a0904109e 100644 --- a/src/case/pager/__test__/pager.test.js +++ b/src/case/pager/__test__/pager.test.js @@ -78,4 +78,20 @@ describe("PagerTest", function () { a.clear(); 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(); + }); }); \ No newline at end of file