Browse Source

Merge pull request #1213 in VISUAL/fineui from ~WINDY/fineui:master to master

* commit 'b3f995a0c0650ad3c1100e1b35c04a2949c858ef':
  update
  无JIRA任务 下拉树选值修改
  BI-52072 test: 钩子和单测修复
es6
windy 5 years ago
parent
commit
a91c17b6b5
  1. 1
      package.json
  2. 3
      src/base/tree/ztree/asynctree.js
  3. 12
      src/core/platform/web/jquery/__test__/fn.test.js
  4. 6
      src/widget/dynamicdate/__test__/dynamicdate.test.js
  5. 4
      src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js

1
package.json

@ -40,6 +40,7 @@
"grunt-contrib-watch": "1.0.0", "grunt-contrib-watch": "1.0.0",
"grunt-webpack": "3.1.3", "grunt-webpack": "3.1.3",
"html-webpack-plugin": "3.2.0", "html-webpack-plugin": "3.2.0",
"husky": "^3.1.0",
"karma": "3.1.4", "karma": "3.1.4",
"karma-chai": "0.1.0", "karma-chai": "0.1.0",
"karma-chrome-launcher": "2.2.0", "karma-chrome-launcher": "2.2.0",

3
src/base/tree/ztree/asynctree.js

@ -115,6 +115,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
var name = this._getNodeValue(treeNode); var name = this._getNodeValue(treeNode);
// var values = parentValues.concat([name]); // var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
this._addTreeNode(this.options.paras.selectedValues, parentValues, name, {});
} else { } else {
var tNode = treeNode; var tNode = treeNode;
var pNode = this._getTree(this.options.paras.selectedValues, parentValues); var pNode = this._getTree(this.options.paras.selectedValues, parentValues);
@ -185,7 +186,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
if (BI.isNull(compare[n])) { if (BI.isNull(compare[n])) {
self._addTreeNode(map, parent, n, item); self._addTreeNode(map, parent, n, item);
} else if (BI.isEmpty(compare[n])) { } else if (BI.isEmpty(compare[n])) {
self._addTreeNode(map, parent, n, {}); self._addTreeNode(map, parent, n, item);
} else { } else {
track(parent.concat([n]), node[n], compare[n]); track(parent.concat([n]), node[n], compare[n]);
} }

12
src/core/platform/web/jquery/__test__/fn.test.js

@ -61,4 +61,16 @@ describe("标红test", function () {
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">a</span><span class=\"bi-keyword-red-mark\">啊</span>"); expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">a</span><span class=\"bi-keyword-red-mark\">啊</span>");
a.destroy(); a.destroy();
}); });
/**
* test_author_windy
*/
it("中文拼音", function () {
var a = BI.Test.createWidget({
type: "bi.layout",
});
a.element.__textKeywordMarked__("日期", "日期");
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">日期</span>");
a.destroy();
});
}); });

6
src/widget/dynamicdate/__test__/dynamicdate.test.js

@ -54,7 +54,7 @@ describe("DateCombo", function () {
// 输入8, 检查popup是否收起 // 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), "8", 56, function () { BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), "8", 56, function () {
BI.nextTick(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是否弹出 // 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () { BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () { BI.nextTick(function () {
@ -82,7 +82,7 @@ describe("DateCombo", function () {
dateCombo.element.find(".bi-date-trigger .bi-basic-button").click(); dateCombo.element.find(".bi-date-trigger .bi-basic-button").click();
BI.nextTick(function () { BI.nextTick(function () {
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(5)").parent().click(); 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(); dateCombo.destroy();
done(); done();
}) })
@ -105,7 +105,7 @@ describe("DateCombo", function () {
var input = dateCombo.element.find(".bi-date-trigger .bi-input"); var input = dateCombo.element.find(".bi-date-trigger .bi-input");
BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () { BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () {
BI.delay(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(); dateCombo.destroy();
done(); done();
}, 300); }, 300);

4
src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js

@ -63,7 +63,7 @@ describe("DateTimeCombo", function () {
// 输入8, 检查popup是否收起 // 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), "8", 56, function () { BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), "8", 56, function () {
BI.nextTick(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是否弹出 // 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () { BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () { BI.nextTick(function () {
@ -115,7 +115,7 @@ describe("DateTimeCombo", function () {
var input = dateCombo.element.find(".bi-date-time-trigger .bi-input"); var input = dateCombo.element.find(".bi-date-time-trigger .bi-input");
BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () { BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () {
BI.delay(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(); dateCombo.destroy();
done(); done();
}, 300); }, 300);

Loading…
Cancel
Save