Browse Source

BI-61182 test: 单测覆盖率55.68%

es6
windy 5 years ago
parent
commit
9d9233d96a
  1. 48
      src/base/list/__test__/listview.test.js
  2. 71
      src/widget/singleslider/__test__/singleslider.test.js

48
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();
});
});

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