Browse Source

Merge pull request #1301 in VISUAL/fineui from ~KOBI/fineui:master to master

* commit '3eae5edb38de6a565ac32c6f7072ed4529f89362':
  KERNEL-3882 添加test_author
  KERNEL-3882 单测
master
Kobi 5 years ago
parent
commit
b624b07e10
  1. 104
      src/base/single/button/node/__test__/icontexticonnode.test.js
  2. 104
      src/base/single/button/node/__test__/icontextnode.test.js
  3. 104
      src/base/single/button/node/__test__/texticonnode.test.js
  4. 106
      src/base/single/button/node/__test__/textnode.test.js

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

@ -0,0 +1,104 @@
/**
* @author Kobi
* @date 2020/4/21
*/
describe("IconTextIconNodeTest", function () {
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
it("getText", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
text: "AAA",
});
expect(iconTextIconNode.getText()).to.equal("AAA");
iconTextIconNode.destroy();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
it("getValue", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
value: "AAA"
});
expect(iconTextIconNode.getValue()).to.equal("AAA");
iconTextIconNode.destroy();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
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();
});
});
});

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

@ -0,0 +1,104 @@
/**
* @author Kobi
* @date 2020/4/21
*/
describe("IconTextNodeTest", function () {
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
it("getText", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
text: "AAA",
});
expect(iconTextNode.getText()).to.equal("AAA");
iconTextNode.destroy();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
it("getValue", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
value: "AAA"
});
expect(iconTextNode.getValue()).to.equal("AAA");
iconTextNode.destroy();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
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();
});
});
});

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

@ -0,0 +1,104 @@
/**
* @author Kobi
* @date 2020/4/21
*/
describe("TextIconNodeTest", function () {
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
it("getText", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
text: "AAA",
});
expect(textIconNode.getText()).to.equal("AAA");
textIconNode.destroy();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
it("getValue", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
value: "AAA"
});
expect(textIconNode.getValue()).to.equal("AAA");
textIconNode.destroy();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
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();
});
});
});

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

@ -0,0 +1,106 @@
/**
* @author Kobi
* @date 2020/4/21
*/
describe("TextNodeTest", function () {
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
it("getText", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
text: "AAA",
whiteSpace: "normal"
});
expect(textNode.getText()).to.equal("AAA");
textNode.destroy();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
it("getValue", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
value: "AAA"
});
expect(textNode.getValue()).to.equal("AAA");
textNode.destroy();
});
/**
* test_author_kobi
*/
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();
});
/**
* test_author_kobi
*/
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