From 4ba4f4f7c3de1f6e1198c9e67ff8fda010e1de8a Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 18 Jul 2019 14:16:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8C=89=E7=85=A7comment=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/utils.js | 5 +++-- test/widget/button.test.js | 2 +- test/widget/text.test.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/utils.js b/test/utils.js index a377cb3a3..b5927fa70 100644 --- a/test/utils.js +++ b/test/utils.js @@ -2,8 +2,9 @@ BI.Test = {}; _.extend(BI.Test, { createWidget: function (widgetJson) { - var widget = BI.createWidget(widgetJson); - widget._isRoot = true; + var widget = BI.createWidget(BI.extend(widgetJson, { + root: true + })); widget._mount(); widget.element.appendTo("body"); return widget; diff --git a/test/widget/button.test.js b/test/widget/button.test.js index 34fb15ca6..afc8b7dff 100644 --- a/test/widget/button.test.js +++ b/test/widget/button.test.js @@ -16,7 +16,7 @@ describe("ButtonTest", function () { }); BI.nextTick(function () { button.element.click(); - expect(button.element[0].querySelector(".bi-text").textContent).to.equal("click"); + expect(button.element.children(".bi-text").text()).to.equal("click"); done(); }); diff --git a/test/widget/text.test.js b/test/widget/text.test.js index 1f8e8b49d..f49a17e8d 100644 --- a/test/widget/text.test.js +++ b/test/widget/text.test.js @@ -11,7 +11,7 @@ describe("TextTest", function () { type: "bi.text" }); text.setText("AAA"); - expect(text.element[0].textContent).to.equal("AAA"); + expect(text.element.text()).to.equal("AAA"); }); /** @@ -22,6 +22,6 @@ describe("TextTest", function () { type: "bi.text" }); text.setStyle({"color": "red"}); - expect(text.element[0].style.color).to.equal("red"); + expect(text.element.getStyle("color")).to.equal("rgb(255, 0, 0)"); }); });