From 1bba5f1c5a3fa84d67618145e2a216e31d8dbfbb Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 10 Mar 2020 17:03:15 +0800 Subject: [PATCH] =?UTF-8?q?BI-61182=20test:=20=E5=8D=95=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/foundation/__test__/message.test.js | 47 +++++++++++++++++++ src/base/single/html/__test__/html.test.js | 42 +++++++++++++++++ .../__test__/colorchooser.test.js | 13 +++++ src/case/colorchooser/colorchooser.js | 1 + 4 files changed, 103 insertions(+) create mode 100644 src/base/foundation/__test__/message.test.js create mode 100644 src/base/single/html/__test__/html.test.js diff --git a/src/base/foundation/__test__/message.test.js b/src/base/foundation/__test__/message.test.js new file mode 100644 index 000000000..7097c50ff --- /dev/null +++ b/src/base/foundation/__test__/message.test.js @@ -0,0 +1,47 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2020/3/9 + */ +describe("MessageTest", function () { + + /** + * test_author_windy + */ + it("alert", function (done) { + BI.Msg.alert("message", "ASASASASA"); + var body = BI.Widget._renderEngine.createElement("body"); + expect(body.find(".bi-message-depend").length).to.equal(1); + BI.nextTick(function () { + body.find(".bi-message-depend .bi-button").click(); + expect(body.find(".bi-message-depend").length).to.equal(0); + done(); + }); + }); + + /** + * test_author_windy + */ + it("toast_hand_close", function (done) { + BI.Msg.toast("message", { + autoClose: false + }); + var body = BI.Widget._renderEngine.createElement("body"); + expect(body.find(".bi-toast").length).to.equal(1); + BI.nextTick(function () { + body.find(".bi-toast .bi-icon-button").click(); + expect(body.find(".bi-toast").length).to.equal(0); + done(); + }); + }); + + /** + * test_author_windy + */ + it("toast_auto_close", function () { + BI.Msg.toast("message"); + var body = BI.Widget._renderEngine.createElement("body"); + expect(body.find(".bi-toast").length).to.equal(1); + }); +}); + diff --git a/src/base/single/html/__test__/html.test.js b/src/base/single/html/__test__/html.test.js new file mode 100644 index 000000000..2d599ecd7 --- /dev/null +++ b/src/base/single/html/__test__/html.test.js @@ -0,0 +1,42 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2020/3/10 + */ + +describe("HtmlTest", function () { + + /** + * test_author_windy + */ + it("html_h1", function () { + var a = BI.Test.createWidget({ + type: "bi.html", + text: "