From cda779e06d9988160db0f5e112fe7c4689311b27 Mon Sep 17 00:00:00 2001 From: Kobi Date: Tue, 21 Apr 2020 19:44:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?KERNEL-3882=20=E5=8D=95=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../node/__test__/icontexticonnode.test.js | 83 ++++++++++++++++++ .../button/node/__test__/icontextnode.test.js | 83 ++++++++++++++++++ .../button/node/__test__/texticonnode.test.js | 83 ++++++++++++++++++ .../button/node/__test__/textnode.test.js | 85 +++++++++++++++++++ 4 files changed, 334 insertions(+) create mode 100644 src/base/single/button/node/__test__/icontexticonnode.test.js create mode 100644 src/base/single/button/node/__test__/icontextnode.test.js create mode 100644 src/base/single/button/node/__test__/texticonnode.test.js create mode 100644 src/base/single/button/node/__test__/textnode.test.js diff --git a/src/base/single/button/node/__test__/icontexticonnode.test.js b/src/base/single/button/node/__test__/icontexticonnode.test.js new file mode 100644 index 000000000..7166d2f20 --- /dev/null +++ b/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(); + }); + }); + +}); diff --git a/src/base/single/button/node/__test__/icontextnode.test.js b/src/base/single/button/node/__test__/icontextnode.test.js new file mode 100644 index 000000000..b12aab5f3 --- /dev/null +++ b/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(); + }); + }); + +}); diff --git a/src/base/single/button/node/__test__/texticonnode.test.js b/src/base/single/button/node/__test__/texticonnode.test.js new file mode 100644 index 000000000..d6bb5f4d7 --- /dev/null +++ b/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(); + }); + }); + +}); diff --git a/src/base/single/button/node/__test__/textnode.test.js b/src/base/single/button/node/__test__/textnode.test.js new file mode 100644 index 000000000..6d885e7c0 --- /dev/null +++ b/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(); + }); + }); + + +}); From 3eae5edb38de6a565ac32c6f7072ed4529f89362 Mon Sep 17 00:00:00 2001 From: Kobi Date: Tue, 21 Apr 2020 19:56:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?KERNEL-3882=20=E6=B7=BB=E5=8A=A0test=5Fauth?= =?UTF-8?q?or?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../node/__test__/icontexticonnode.test.js | 21 +++++++++++++++++++ .../button/node/__test__/icontextnode.test.js | 21 +++++++++++++++++++ .../button/node/__test__/texticonnode.test.js | 21 +++++++++++++++++++ .../button/node/__test__/textnode.test.js | 21 +++++++++++++++++++ 4 files changed, 84 insertions(+) diff --git a/src/base/single/button/node/__test__/icontexticonnode.test.js b/src/base/single/button/node/__test__/icontexticonnode.test.js index 7166d2f20..ae2a8fbb4 100644 --- a/src/base/single/button/node/__test__/icontexticonnode.test.js +++ b/src/base/single/button/node/__test__/icontexticonnode.test.js @@ -5,6 +5,9 @@ describe("IconTextIconNodeTest", function () { + /** + * test_author_kobi + */ it("setText", function () { var iconTextIconNode = BI.Test.createWidget({ type: "bi.icon_text_icon_node" @@ -14,6 +17,9 @@ describe("IconTextIconNodeTest", function () { iconTextIconNode.destroy(); }); + /** + * test_author_kobi + */ it("getText", function () { var iconTextIconNode = BI.Test.createWidget({ type: "bi.icon_text_icon_node", @@ -23,6 +29,9 @@ describe("IconTextIconNodeTest", function () { iconTextIconNode.destroy(); }); + /** + * test_author_kobi + */ it("setValue", function () { var iconTextIconNode = BI.Test.createWidget({ type: "bi.icon_text_icon_node" @@ -32,6 +41,9 @@ describe("IconTextIconNodeTest", function () { iconTextIconNode.destroy(); }); + /** + * test_author_kobi + */ it("readonly下的setValue", function () { var iconTextIconNode = BI.Test.createWidget({ type: "bi.icon_text_icon_node", @@ -43,6 +55,9 @@ describe("IconTextIconNodeTest", function () { iconTextIconNode.destroy(); }); + /** + * test_author_kobi + */ it("getValue", function () { var iconTextIconNode = BI.Test.createWidget({ type: "bi.icon_text_icon_node", @@ -52,6 +67,9 @@ describe("IconTextIconNodeTest", function () { iconTextIconNode.destroy(); }); + /** + * test_author_kobi + */ it("doRedMark和unRedMark", function () { var iconTextIconNode = BI.Test.createWidget({ type: "bi.icon_text_icon_node", @@ -64,6 +82,9 @@ describe("IconTextIconNodeTest", function () { iconTextIconNode.destroy(); }); + /** + * test_author_kobi + */ it("Click点击触发事件", function (done) { var iconTextIconNode = BI.Test.createWidget({ type: "bi.icon_text_icon_node", diff --git a/src/base/single/button/node/__test__/icontextnode.test.js b/src/base/single/button/node/__test__/icontextnode.test.js index b12aab5f3..2319e23e2 100644 --- a/src/base/single/button/node/__test__/icontextnode.test.js +++ b/src/base/single/button/node/__test__/icontextnode.test.js @@ -5,6 +5,9 @@ describe("IconTextNodeTest", function () { + /** + * test_author_kobi + */ it("setText", function () { var iconTextNode = BI.Test.createWidget({ type: "bi.icon_text_node" @@ -14,6 +17,9 @@ describe("IconTextNodeTest", function () { iconTextNode.destroy(); }); + /** + * test_author_kobi + */ it("getText", function () { var iconTextNode = BI.Test.createWidget({ type: "bi.icon_text_node", @@ -23,6 +29,9 @@ describe("IconTextNodeTest", function () { iconTextNode.destroy(); }); + /** + * test_author_kobi + */ it("setValue", function () { var iconTextNode = BI.Test.createWidget({ type: "bi.icon_text_node" @@ -32,6 +41,9 @@ describe("IconTextNodeTest", function () { iconTextNode.destroy(); }); + /** + * test_author_kobi + */ it("readonly下的setValue", function () { var iconTextNode = BI.Test.createWidget({ type: "bi.icon_text_node", @@ -43,6 +55,9 @@ describe("IconTextNodeTest", function () { iconTextNode.destroy(); }); + /** + * test_author_kobi + */ it("getValue", function () { var iconTextNode = BI.Test.createWidget({ type: "bi.icon_text_node", @@ -52,6 +67,9 @@ describe("IconTextNodeTest", function () { iconTextNode.destroy(); }); + /** + * test_author_kobi + */ it("doRedMark和unRedMark", function () { var iconTextNode = BI.Test.createWidget({ type: "bi.icon_text_node", @@ -64,6 +82,9 @@ describe("IconTextNodeTest", function () { iconTextNode.destroy(); }); + /** + * test_author_kobi + */ it("Click点击触发事件", function (done) { var iconTextNode = BI.Test.createWidget({ type: "bi.icon_text_node", diff --git a/src/base/single/button/node/__test__/texticonnode.test.js b/src/base/single/button/node/__test__/texticonnode.test.js index d6bb5f4d7..9eb4ec2db 100644 --- a/src/base/single/button/node/__test__/texticonnode.test.js +++ b/src/base/single/button/node/__test__/texticonnode.test.js @@ -5,6 +5,9 @@ describe("TextIconNodeTest", function () { + /** + * test_author_kobi + */ it("setText", function () { var textIconNode = BI.Test.createWidget({ type: "bi.text_icon_node" @@ -14,6 +17,9 @@ describe("TextIconNodeTest", function () { textIconNode.destroy(); }); + /** + * test_author_kobi + */ it("getText", function () { var textIconNode = BI.Test.createWidget({ type: "bi.text_icon_node", @@ -23,6 +29,9 @@ describe("TextIconNodeTest", function () { textIconNode.destroy(); }); + /** + * test_author_kobi + */ it("setValue", function () { var textIconNode = BI.Test.createWidget({ type: "bi.text_icon_node" @@ -32,6 +41,9 @@ describe("TextIconNodeTest", function () { textIconNode.destroy(); }); + /** + * test_author_kobi + */ it("readonly下的setValue", function () { var textIconNode = BI.Test.createWidget({ type: "bi.text_icon_node", @@ -43,6 +55,9 @@ describe("TextIconNodeTest", function () { textIconNode.destroy(); }); + /** + * test_author_kobi + */ it("getValue", function () { var textIconNode = BI.Test.createWidget({ type: "bi.text_icon_node", @@ -52,6 +67,9 @@ describe("TextIconNodeTest", function () { textIconNode.destroy(); }); + /** + * test_author_kobi + */ it("doRedMark和unRedMark", function () { var textIconNode = BI.Test.createWidget({ type: "bi.text_icon_node", @@ -64,6 +82,9 @@ describe("TextIconNodeTest", function () { textIconNode.destroy(); }); + /** + * test_author_kobi + */ it("Click点击触发事件", function (done) { var textIconNode = BI.Test.createWidget({ type: "bi.text_icon_node", diff --git a/src/base/single/button/node/__test__/textnode.test.js b/src/base/single/button/node/__test__/textnode.test.js index 6d885e7c0..5674ae263 100644 --- a/src/base/single/button/node/__test__/textnode.test.js +++ b/src/base/single/button/node/__test__/textnode.test.js @@ -5,6 +5,9 @@ describe("TextNodeTest", function () { + /** + * test_author_kobi + */ it("setText", function () { var textNode = BI.Test.createWidget({ type: "bi.text_node" @@ -14,6 +17,9 @@ describe("TextNodeTest", function () { textNode.destroy(); }); + /** + * test_author_kobi + */ it("getText", function () { var textNode = BI.Test.createWidget({ type: "bi.text_node", @@ -24,6 +30,9 @@ describe("TextNodeTest", function () { textNode.destroy(); }); + /** + * test_author_kobi + */ it("setValue", function () { var textNode = BI.Test.createWidget({ type: "bi.text_node" @@ -33,6 +42,9 @@ describe("TextNodeTest", function () { textNode.destroy(); }); + /** + * test_author_kobi + */ it("readonly下的setValue", function () { var textNode = BI.Test.createWidget({ type: "bi.text_node", @@ -44,6 +56,9 @@ describe("TextNodeTest", function () { textNode.destroy(); }); + /** + * test_author_kobi + */ it("getValue", function () { var textNode = BI.Test.createWidget({ type: "bi.text_node", @@ -53,6 +68,9 @@ describe("TextNodeTest", function () { textNode.destroy(); }); + /** + * test_author_kobi + */ it("doRedMark和unRedMark", function () { var textNode = BI.Test.createWidget({ type: "bi.text_node", @@ -65,6 +83,9 @@ describe("TextNodeTest", function () { textNode.destroy(); }); + /** + * test_author_kobi + */ it("Click点击触发事件", function (done) { var textNode = BI.Test.createWidget({ type: "bi.text_node",