From c7afb99a4ea26fe6c49b82f4dc718e069707a688 Mon Sep 17 00:00:00 2001
From: windy <1374721899@qq.com>
Date: Tue, 10 Dec 2019 13:54:11 +0800
Subject: [PATCH] =?UTF-8?q?BI-52072=20test:=20=E9=92=A9=E5=AD=90=E5=92=8C?=
=?UTF-8?q?=E5=8D=95=E6=B5=8B=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 8 +++++++-
src/core/platform/web/jquery/__test__/fn.test.js | 12 ++++++++++++
src/widget/dynamicdate/__test__/dynamicdate.test.js | 6 +++---
.../dynamicdatetime/__test__/dynamicdatetime.test.js | 4 ++--
4 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/package.json b/package.json
index f8e2f9636..83f98ca68 100644
--- a/package.json
+++ b/package.json
@@ -40,6 +40,7 @@
"grunt-contrib-watch": "1.0.0",
"grunt-webpack": "3.1.3",
"html-webpack-plugin": "3.2.0",
+ "husky": "^3.1.0",
"karma": "3.1.4",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "2.2.0",
@@ -86,5 +87,10 @@
"finebi"
],
"author": "fanruan",
- "license": "MIT"
+ "license": "MIT",
+ "husky": {
+ "hooks": {
+ "pre-push": "npm run test"
+ }
+ }
}
diff --git a/src/core/platform/web/jquery/__test__/fn.test.js b/src/core/platform/web/jquery/__test__/fn.test.js
index 8a2b475f7..edcbe5b3a 100644
--- a/src/core/platform/web/jquery/__test__/fn.test.js
+++ b/src/core/platform/web/jquery/__test__/fn.test.js
@@ -61,4 +61,16 @@ describe("标红test", function () {
expect(a.element.html()).to.equal("a啊");
a.destroy();
});
+
+ /**
+ * test_author_windy
+ */
+ it("中文拼音", function () {
+ var a = BI.Test.createWidget({
+ type: "bi.layout",
+ });
+ a.element.__textKeywordMarked__("日期", "日期");
+ expect(a.element.html()).to.equal("日期");
+ a.destroy();
+ });
});
\ No newline at end of file
diff --git a/src/widget/dynamicdate/__test__/dynamicdate.test.js b/src/widget/dynamicdate/__test__/dynamicdate.test.js
index 28ff2e9d9..308c09094 100644
--- a/src/widget/dynamicdate/__test__/dynamicdate.test.js
+++ b/src/widget/dynamicdate/__test__/dynamicdate.test.js
@@ -54,7 +54,7 @@ describe("DateCombo", function () {
// 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), "8", 56, function () {
BI.nextTick(function () {
- expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).to.equal("none");
+ expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").length).to.equal(0);
// 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () {
@@ -82,7 +82,7 @@ describe("DateCombo", function () {
dateCombo.element.find(".bi-date-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(5)").parent().click();
- expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).to.equal("none");
+ expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").length).to.equal(0);
dateCombo.destroy();
done();
})
@@ -105,7 +105,7 @@ describe("DateCombo", function () {
var input = dateCombo.element.find(".bi-date-trigger .bi-input");
BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
- expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).to.equal("none");
+ expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").length).to.equal(0);
dateCombo.destroy();
done();
}, 300);
diff --git a/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js b/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js
index c6ffded8e..a11918655 100644
--- a/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js
+++ b/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js
@@ -63,7 +63,7 @@ describe("DateTimeCombo", function () {
// 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), "8", 56, function () {
BI.nextTick(function () {
- expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").css("display")).to.equal("none");
+ expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").length).to.equal(0);
// 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () {
@@ -115,7 +115,7 @@ describe("DateTimeCombo", function () {
var input = dateCombo.element.find(".bi-date-time-trigger .bi-input");
BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
- expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").css("display")).to.equal("none");
+ expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").length).to.equal(0);
dateCombo.destroy();
done();
}, 300);