Browse Source

Merge pull request #1265 in VISUAL/fineui from ~WINDY/fineui:master to master

* commit 'c863894f08c8fad6a913dd727b6c0aa23c3bd44c':
  BI-52072 test: 单测
master
windy 5 years ago
parent
commit
f52bff66e0
  1. 132
      src/case/combo/bubblecombo/__test__/combo.bubble.test.js
  2. 50
      src/case/combo/editoriconcheckcombo/__test__/combo.editiconcheck.test.js
  3. 64
      src/case/combo/icontextvaluecombo/__test__/combo.icontextvalue.test.js
  4. 118
      src/case/combo/textvaluecombo/__test__/combo.textvalue.test.js
  5. 101
      src/widget/timeinterval/__test__/timeinterval.test.js

132
src/case/combo/bubblecombo/__test__/combo.bubble.test.js

@ -0,0 +1,132 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/3/2
*/
describe("bubble_combo", function () {
/**
* test_author_windy
*/
it("测试弹出收起", function (done) {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
type: "bi.button",
text: "测试",
height: 24
},
popup: {
el: {
type: "bi.button_group",
items: BI.makeArray(100, {
type: "bi.text_item",
height: 24,
text: "item"
}),
layouts: [{
type: "bi.vertical"
}]
},
maxHeight: 200
}
});
BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).to.equal("block");
bubbleCombo.destroy();
done();
})
});
/**
* test_author_windy
*/
it("测试弹出收起", function (done) {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
type: "bi.button",
text: "测试",
height: 24
},
popup: {
el: {
type: "bi.button_group",
items: BI.makeArray(100, {
type: "bi.text_item",
height: 24,
text: "item"
}),
layouts: [{
type: "bi.vertical"
}]
},
maxHeight: 200
}
});
BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).to.equal("block");
bubbleCombo.destroy();
done();
})
});
/**
* test_author_windy
*/
it("bubble_bar_popup_view", function (done) {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
type: "bi.button",
text: "测试",
height: 24
},
popup: {
type: "bi.bubble_bar_popup_view",
el: {
type: "bi.vertical",
height: 40
}
}
});
BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).to.equal(1);
bubbleCombo.destroy();
done();
})
});
/**
* test_author_windy
*/
it("text_bubble_bar_popup_view", function (done) {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
type: "bi.button",
text: "测试",
height: 24
},
popup: {
type: "bi.text_bubble_bar_popup_view",
el: {
type: "bi.vertical",
height: 40
}
}
});
BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).to.equal(1);
bubbleCombo.destroy();
done();
})
});
});

50
src/case/combo/editoriconcheckcombo/__test__/combo.editiconcheck.test.js

@ -0,0 +1,50 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/3/2
*/
describe("edit_icon_check_combo", function () {
/**
* test_author_windy
*/
it("测试弹出收起", function (done) {
var combo = BI.Test.createWidget({
type: "bi.editor_icon_check_combo",
watermark: "默认值",
width: 200,
height: 24,
value: 2,
items: [{
text: "MVC-1",
value: "1"
}, {
text: "MVC-2",
value: "2"
}, {
text: "MVC-3",
value: "3"
}]
});
BI.nextTick(function () {
combo.element.find(".bi-editor-trigger").click();
combo.element.find(".bi-text-icon-popup .bi-single-select-item").click();
expect(combo.getValue()[0]).to.equal("3");
combo.populate([{
text: "MVC-1",
value: "4"
}, {
text: "MVC-2",
value: "5"
}, {
text: "MVC-3",
value: "6"
}]);
combo.setValue("4");
expect(combo.getValue()[0]).to.equal("4");
combo.destroy();
done();
})
});
});

64
src/case/combo/icontextvaluecombo/__test__/combo.icontextvalue.test.js

@ -0,0 +1,64 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/3/2
*/
describe("icontextvaluecombo", function () {
/**
* test_author_windy
*/
it("测试setValue", function () {
var combo = BI.Test.createWidget({
type: "bi.icon_text_value_combo",
text: "默认值",
value: 22,
width: 300,
items: [{
text: "MVC-1",
iconCls: "date-font",
value: 1
}, {
text: "MVC-2",
iconCls: "search-font",
value: 2
}, {
text: "MVC-3",
iconCls: "pull-right-font",
value: 3
}]
});
combo.setValue(2);
expect(combo.getValue()[0]).to.equal(2);
});
/**
* test_author_windy
*/
it("测试populate", function (done) {
var combo = BI.Test.createWidget({
type: "bi.text_value_combo",
text: "默认值",
value: 22,
width: 300
});
combo.populate([{
text: "MVC-1",
iconCls: "date-font",
value: 1
}, {
text: "MVC-2",
iconCls: "search-font",
value: 2
}, {
text: "MVC-3",
iconCls: "pull-right-font",
value: 3
}]);
combo.setValue(2);
expect(combo.getValue()[0]).to.equal(2);
done();
});
});

118
src/case/combo/textvaluecombo/__test__/combo.textvalue.test.js

@ -0,0 +1,118 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/3/2
*/
describe("textvaluecombo", function () {
/**
* test_author_windy
*/
it("测试setValue", function () {
var combo = BI.Test.createWidget({
type: "bi.text_value_combo",
text: "默认值",
value: 22,
width: 300,
items: [{
text: "MVC-1",
iconCls: "date-font",
value: 1
}, {
text: "MVC-2",
iconCls: "search-font",
value: 2
}, {
text: "MVC-3",
iconCls: "pull-right-font",
value: 3
}]
});
combo.setValue(2);
expect(combo.getValue()[0]).to.equal(2);
});
/**
* test_author_windy
*/
it("测试populate", function (done) {
var combo = BI.Test.createWidget({
type: "bi.text_value_combo",
text: "默认值",
value: 22,
width: 300
});
combo.populate([{
text: "MVC-1",
iconCls: "date-font",
value: 1
}, {
text: "MVC-2",
iconCls: "search-font",
value: 2
}, {
text: "MVC-3",
iconCls: "pull-right-font",
value: 3
}]);
combo.setValue(2);
expect(combo.getValue()[0]).to.equal(2);
done();
});
/**
* test_author_windy
*/
it("测试small_setValue", function () {
var combo = BI.Test.createWidget({
type: "bi.small_text_value_combo",
text: "默认值",
value: 22,
width: 300,
items: [{
text: "MVC-1",
iconCls: "date-font",
value: 1
}, {
text: "MVC-2",
iconCls: "search-font",
value: 2
}, {
text: "MVC-3",
iconCls: "pull-right-font",
value: 3
}]
});
combo.setValue(2);
expect(combo.getValue()[0]).to.equal(2);
});
/**
* test_author_windy
*/
it("测试small_populate", function (done) {
var combo = BI.Test.createWidget({
type: "bi.small_text_value_combo",
text: "默认值",
value: 22,
width: 300
});
combo.populate([{
text: "MVC-1",
iconCls: "date-font",
value: 1
}, {
text: "MVC-2",
iconCls: "search-font",
value: 2
}, {
text: "MVC-3",
iconCls: "pull-right-font",
value: 3
}]);
combo.setValue(2);
expect(combo.getValue()[0]).to.equal(2);
done();
});
});

101
src/widget/timeinterval/__test__/timeinterval.test.js

@ -0,0 +1,101 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/2/18
*/
describe("DateInterval", function () {
/**
* test_author_windy
*/
it("DateInterval_defaultValue", function () {
var dateInterval = BI.Test.createWidget({
type: "bi.date_interval",
value: {
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("TimeInterval_defaultValue", function () {
var dateInterval = BI.Test.createWidget({
type: "bi.time_interval",
value: {
start: {
type: 1,
value: {
year: 2018,
month: 1,
day: 12,
hour: 10,
minute: 10,
second: 10
}
},
end: {
type: 2,
value: {
year: -1,
position: 2
}
}
},
});
expect(dateInterval.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-01-12 10:10:102019-01-01 00:00:00");
dateInterval.destroy();
});
/**
* test_author_windy
*/
it("TimePeriod_defaultValue", function () {
var dateInterval = BI.Test.createWidget({
type: "bi.time_periods",
value: {
start: {
hour: 7,
minute: 23,
second: 14
},
end: {
hour: 23,
minute: 34,
second: 32
}
},
});
expect(dateInterval.getValue()).to.deep.equal({
"end": {
"hour": 23,
"minute": 34,
"second": 32
},
"start": {
"hour": 7,
"minute": 23,
"second": 14
}
});
dateInterval.destroy();
});
});
Loading…
Cancel
Save