Browse Source

KERNEL-3882 单测

master
Kobi 5 years ago
parent
commit
cda779e06d
  1. 83
      src/base/single/button/node/__test__/icontexticonnode.test.js
  2. 83
      src/base/single/button/node/__test__/icontextnode.test.js
  3. 83
      src/base/single/button/node/__test__/texticonnode.test.js
  4. 85
      src/base/single/button/node/__test__/textnode.test.js

83
src/base/single/button/node/__test__/icontexticonnode.test.js

@ -0,0 +1,83 @@
/**
* @author Kobi
* @date 2020/4/21
*/
describe("IconTextIconNodeTest", function () {
it("setText", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node"
});
iconTextIconNode.setText("AAA");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextIconNode.destroy();
});
it("getText", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
text: "AAA",
});
expect(iconTextIconNode.getText()).to.equal("AAA");
iconTextIconNode.destroy();
});
it("setValue", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node"
});
iconTextIconNode.setValue("AAA");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextIconNode.destroy();
});
it("readonly下的setValue", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
value: "AAA",
readonly: true
});
iconTextIconNode.setValue("BBB");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextIconNode.destroy();
});
it("getValue", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
value: "AAA"
});
expect(iconTextIconNode.getValue()).to.equal("AAA");
iconTextIconNode.destroy();
});
it("doRedMark和unRedMark", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
text: "要标红的AAA",
});
iconTextIconNode.doRedMark("AAA");
expect(iconTextIconNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
iconTextIconNode.unRedMark();
expect(iconTextIconNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
iconTextIconNode.destroy();
});
it("Click点击触发事件", function (done) {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
text: "AAA",
handler: function () {
this.setText("click");
}
});
BI.nextTick(function () {
iconTextIconNode.element.click();
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("click");
iconTextIconNode.destroy();
done();
});
});
});

83
src/base/single/button/node/__test__/icontextnode.test.js

@ -0,0 +1,83 @@
/**
* @author Kobi
* @date 2020/4/21
*/
describe("IconTextNodeTest", function () {
it("setText", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node"
});
iconTextNode.setText("AAA");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextNode.destroy();
});
it("getText", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
text: "AAA",
});
expect(iconTextNode.getText()).to.equal("AAA");
iconTextNode.destroy();
});
it("setValue", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node"
});
iconTextNode.setValue("AAA");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextNode.destroy();
});
it("readonly下的setValue", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
value: "AAA",
readonly: true
});
iconTextNode.setValue("BBB");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextNode.destroy();
});
it("getValue", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
value: "AAA"
});
expect(iconTextNode.getValue()).to.equal("AAA");
iconTextNode.destroy();
});
it("doRedMark和unRedMark", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
text: "要标红的AAA",
});
iconTextNode.doRedMark("AAA");
expect(iconTextNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
iconTextNode.unRedMark();
expect(iconTextNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
iconTextNode.destroy();
});
it("Click点击触发事件", function (done) {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
text: "AAA",
handler: function () {
this.setText("click");
}
});
BI.nextTick(function () {
iconTextNode.element.click();
expect(iconTextNode.element.find(".bi-text").text()).to.equal("click");
iconTextNode.destroy();
done();
});
});
});

83
src/base/single/button/node/__test__/texticonnode.test.js

@ -0,0 +1,83 @@
/**
* @author Kobi
* @date 2020/4/21
*/
describe("TextIconNodeTest", function () {
it("setText", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node"
});
textIconNode.setText("AAA");
expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA");
textIconNode.destroy();
});
it("getText", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
text: "AAA",
});
expect(textIconNode.getText()).to.equal("AAA");
textIconNode.destroy();
});
it("setValue", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node"
});
textIconNode.setValue("AAA");
expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA");
textIconNode.destroy();
});
it("readonly下的setValue", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
value: "AAA",
readonly: true
});
textIconNode.setValue("BBB");
expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA");
textIconNode.destroy();
});
it("getValue", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
value: "AAA"
});
expect(textIconNode.getValue()).to.equal("AAA");
textIconNode.destroy();
});
it("doRedMark和unRedMark", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
text: "要标红的AAA",
});
textIconNode.doRedMark("AAA");
expect(textIconNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textIconNode.unRedMark();
expect(textIconNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textIconNode.destroy();
});
it("Click点击触发事件", function (done) {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
text: "AAA",
handler: function () {
this.setText("click");
}
});
BI.nextTick(function () {
textIconNode.element.click();
expect(textIconNode.element.find(".bi-text").text()).to.equal("click");
textIconNode.destroy();
done();
});
});
});

85
src/base/single/button/node/__test__/textnode.test.js

@ -0,0 +1,85 @@
/**
* @author Kobi
* @date 2020/4/21
*/
describe("TextNodeTest", function () {
it("setText", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node"
});
textNode.setText("AAA");
expect(textNode.element.children(".bi-text").text()).to.equal("AAA");
textNode.destroy();
});
it("getText", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
text: "AAA",
whiteSpace: "normal"
});
expect(textNode.getText()).to.equal("AAA");
textNode.destroy();
});
it("setValue", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node"
});
textNode.setValue("AAA");
expect(textNode.element.children(".bi-text").text()).to.equal("AAA");
textNode.destroy();
});
it("readonly下的setValue", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
value: "AAA",
readonly: true
});
textNode.setValue("BBB");
expect(textNode.element.children(".bi-text").text()).to.equal("AAA");
textNode.destroy();
});
it("getValue", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
value: "AAA"
});
expect(textNode.getValue()).to.equal("AAA");
textNode.destroy();
});
it("doRedMark和unRedMark", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
text: "要标红的AAA",
});
textNode.doRedMark("AAA");
expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textNode.unRedMark();
expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textNode.destroy();
});
it("Click点击触发事件", function (done) {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
text: "AAA",
handler: function () {
this.setText("click");
}
});
BI.nextTick(function () {
textNode.element.click();
expect(textNode.element.children(".bi-text").text()).to.equal("click");
textNode.destroy();
done();
});
});
});
Loading…
Cancel
Save