From 9d9233d96a518bdddd2d1c559798a5f4f9e21944 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 24 Mar 2020 14:02:25 +0800 Subject: [PATCH] =?UTF-8?q?BI-61182=20test:=20=E5=8D=95=E6=B5=8B=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E7=8E=8755.68%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/list/__test__/listview.test.js | 48 +++++++++++++ .../__test__/singleslider.test.js | 71 +++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 src/base/list/__test__/listview.test.js create mode 100644 src/widget/singleslider/__test__/singleslider.test.js diff --git a/src/base/list/__test__/listview.test.js b/src/base/list/__test__/listview.test.js new file mode 100644 index 000000000..4be8993c5 --- /dev/null +++ b/src/base/list/__test__/listview.test.js @@ -0,0 +1,48 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2020/3/24 + */ + +// TODO 展示类控件测什么没想好标记一下 +describe("ListView && VirtualList", function () { + + /** + * test_author_windy + */ + it("ListView初始化测试", function () { + var a = BI.Test.createWidget({ + type: "bi.list_view", + el: { + type: "bi.left" + }, + items: BI.map(BI.range(0, 100), function (i, item) { + return BI.extend({}, item, { + type: "bi.label", + width: 200, + height: 200, + text: (i + 1) + }); + }) + }); + a.destroy(); + }); + + + /** + * test_author_windy + */ + it("VirtualList初始化测试", function () { + var a = BI.Test.createWidget({ + type: "bi.virtual_list", + items: BI.map(BI.range(0, 100), function (i, item) { + return BI.extend({}, item, { + type: "bi.label", + height: 30, + text: (i + 1) + "." + item.text + }); + }) + }); + a.destroy(); + }); +}); \ No newline at end of file diff --git a/src/widget/singleslider/__test__/singleslider.test.js b/src/widget/singleslider/__test__/singleslider.test.js new file mode 100644 index 000000000..8a37715e9 --- /dev/null +++ b/src/widget/singleslider/__test__/singleslider.test.js @@ -0,0 +1,71 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2020/3/24 + */ + +describe("SingleSlider", function () { + + /** + * test_author_windy + */ + it("singleSlider", function () { + var widget = BI.Test.createWidget({ + type: "bi.single_slider", + digit: 0, + width: 300, + height: 50 + }); + widget.setMinAndMax({ + min: 10, + max: 120 + }); + widget.setValue(30); + widget.populate(); + expect(widget.element.find(".blue-track").width() > 0).to.equal(true); + widget.destroy(); + }); + + /** + * test_author_windy + */ + it("singleSlidernormal", function () { + var widget = BI.Test.createWidget({ + type: "bi.single_slider_normal", + digit: 0, + width: 300, + height: 50 + }); + widget.setMinAndMax({ + min: 10, + max: 120 + }); + widget.setValue(30); + widget.populate(); + expect(widget.element.find(".blue-track").width() > 0).to.equal(true); + widget.destroy(); + }); + + + /** + * test_author_windy + */ + it("singleSliderlabel", function () { + var widget = BI.Test.createWidget({ + type: "bi.single_slider_label", + width: 300, + height: 50, + digit: 0, + unit: "个", + cls: "layout-bg-white" + }); + widget.setMinAndMax({ + min: 10, + max: 120 + }); + widget.setValue(30); + widget.populate(); + expect(widget.element.find(".blue-track").width() > 0).to.equal(true); + widget.destroy(); + }); +}); \ No newline at end of file