Browse Source

BI-51100 && REPORT-21752 单测和搜索实际值配置

es6
windy 5 years ago
parent
commit
7b3877ac77
  1. 14
      dist/2.0/fineui.ie.js
  2. 14
      dist/2.0/fineui.js
  3. 3
      dist/base.js
  4. 14
      dist/bundle.ie.js
  5. 14
      dist/bundle.js
  6. 14
      dist/fineui.ie.js
  7. 14
      dist/fineui.js
  8. 14
      dist/fineui_without_jquery_polyfill.js
  9. 11
      dist/widget.js
  10. 3
      src/base/single/input/input.js
  11. 70
      src/widget/datetime/__test__/datetime.test.js
  12. 182
      src/widget/editor/__test__/editor.search.test.js
  13. 5
      src/widget/editor/__test__/editor.text.test.js
  14. 3
      src/widget/editor/editor.search.js
  15. 4
      src/widget/multilayerselecttree/multilayerselecttree.trigger.js
  16. 4
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  17. 6
      test/utils.js

14
dist/2.0/fineui.ie.js vendored

@ -48357,7 +48357,7 @@ BI.Input = BI.inherit(BI.Single, {
_keydown(e.keyCode);
}
})
.on("input propertychange", function (e) {
.on("input", function (e) {
// 输入内容全选并直接删光,如果按键没放开就失去焦点不会触发keyup,被focusout覆盖了
// 其中propertychange在元素属性发生改变的时候就会触发 是为了兼容IE8
// 通过keyCode判断会漏掉输入法点击输入(右键粘贴暂缓)
@ -48440,6 +48440,7 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
console.log(123);
if (!this.isValid() || BI.trim(this._lastChangedValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange();
}
@ -66749,7 +66750,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
hgap: 1,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
quitChecker: o.quitChecker,
value: o.value
});
this.clear = BI.createWidget({
type: "bi.icon_button",
@ -69263,11 +69265,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
@ -70444,11 +70446,11 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

14
dist/2.0/fineui.js vendored

@ -48761,7 +48761,7 @@ BI.Input = BI.inherit(BI.Single, {
_keydown(e.keyCode);
}
})
.on("input propertychange", function (e) {
.on("input", function (e) {
// 输入内容全选并直接删光,如果按键没放开就失去焦点不会触发keyup,被focusout覆盖了
// 其中propertychange在元素属性发生改变的时候就会触发 是为了兼容IE8
// 通过keyCode判断会漏掉输入法点击输入(右键粘贴暂缓)
@ -48844,6 +48844,7 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
console.log(123);
if (!this.isValid() || BI.trim(this._lastChangedValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange();
}
@ -67153,7 +67154,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
hgap: 1,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
quitChecker: o.quitChecker,
value: o.value
});
this.clear = BI.createWidget({
type: "bi.icon_button",
@ -69667,11 +69669,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
@ -70848,11 +70850,11 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

3
dist/base.js vendored

@ -10488,7 +10488,7 @@ BI.Input = BI.inherit(BI.Single, {
_keydown(e.keyCode);
}
})
.on("input propertychange", function (e) {
.on("input", function (e) {
// 输入内容全选并直接删光,如果按键没放开就失去焦点不会触发keyup,被focusout覆盖了
// 其中propertychange在元素属性发生改变的时候就会触发 是为了兼容IE8
// 通过keyCode判断会漏掉输入法点击输入(右键粘贴暂缓)
@ -10571,6 +10571,7 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
console.log(123);
if (!this.isValid() || BI.trim(this._lastChangedValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange();
}

14
dist/bundle.ie.js vendored

@ -48357,7 +48357,7 @@ BI.Input = BI.inherit(BI.Single, {
_keydown(e.keyCode);
}
})
.on("input propertychange", function (e) {
.on("input", function (e) {
// 输入内容全选并直接删光,如果按键没放开就失去焦点不会触发keyup,被focusout覆盖了
// 其中propertychange在元素属性发生改变的时候就会触发 是为了兼容IE8
// 通过keyCode判断会漏掉输入法点击输入(右键粘贴暂缓)
@ -48440,6 +48440,7 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
console.log(123);
if (!this.isValid() || BI.trim(this._lastChangedValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange();
}
@ -66749,7 +66750,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
hgap: 1,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
quitChecker: o.quitChecker,
value: o.value
});
this.clear = BI.createWidget({
type: "bi.icon_button",
@ -69263,11 +69265,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
@ -70444,11 +70446,11 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

14
dist/bundle.js vendored

@ -48761,7 +48761,7 @@ BI.Input = BI.inherit(BI.Single, {
_keydown(e.keyCode);
}
})
.on("input propertychange", function (e) {
.on("input", function (e) {
// 输入内容全选并直接删光,如果按键没放开就失去焦点不会触发keyup,被focusout覆盖了
// 其中propertychange在元素属性发生改变的时候就会触发 是为了兼容IE8
// 通过keyCode判断会漏掉输入法点击输入(右键粘贴暂缓)
@ -48844,6 +48844,7 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
console.log(123);
if (!this.isValid() || BI.trim(this._lastChangedValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange();
}
@ -67153,7 +67154,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
hgap: 1,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
quitChecker: o.quitChecker,
value: o.value
});
this.clear = BI.createWidget({
type: "bi.icon_button",
@ -69667,11 +69669,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
@ -70848,11 +70850,11 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

14
dist/fineui.ie.js vendored

@ -48602,7 +48602,7 @@ BI.Input = BI.inherit(BI.Single, {
_keydown(e.keyCode);
}
})
.on("input propertychange", function (e) {
.on("input", function (e) {
// 输入内容全选并直接删光,如果按键没放开就失去焦点不会触发keyup,被focusout覆盖了
// 其中propertychange在元素属性发生改变的时候就会触发 是为了兼容IE8
// 通过keyCode判断会漏掉输入法点击输入(右键粘贴暂缓)
@ -48685,6 +48685,7 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
console.log(123);
if (!this.isValid() || BI.trim(this._lastChangedValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange();
}
@ -66994,7 +66995,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
hgap: 1,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
quitChecker: o.quitChecker,
value: o.value
});
this.clear = BI.createWidget({
type: "bi.icon_button",
@ -69508,11 +69510,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
@ -70689,11 +70691,11 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

14
dist/fineui.js vendored

@ -49006,7 +49006,7 @@ BI.Input = BI.inherit(BI.Single, {
_keydown(e.keyCode);
}
})
.on("input propertychange", function (e) {
.on("input", function (e) {
// 输入内容全选并直接删光,如果按键没放开就失去焦点不会触发keyup,被focusout覆盖了
// 其中propertychange在元素属性发生改变的时候就会触发 是为了兼容IE8
// 通过keyCode判断会漏掉输入法点击输入(右键粘贴暂缓)
@ -49089,6 +49089,7 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
console.log(123);
if (!this.isValid() || BI.trim(this._lastChangedValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange();
}
@ -67398,7 +67399,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
hgap: 1,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
quitChecker: o.quitChecker,
value: o.value
});
this.clear = BI.createWidget({
type: "bi.icon_button",
@ -69912,11 +69914,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
@ -71093,11 +71095,11 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

14
dist/fineui_without_jquery_polyfill.js vendored

@ -35478,7 +35478,7 @@ BI.Input = BI.inherit(BI.Single, {
_keydown(e.keyCode);
}
})
.on("input propertychange", function (e) {
.on("input", function (e) {
// 输入内容全选并直接删光,如果按键没放开就失去焦点不会触发keyup,被focusout覆盖了
// 其中propertychange在元素属性发生改变的时候就会触发 是为了兼容IE8
// 通过keyCode判断会漏掉输入法点击输入(右键粘贴暂缓)
@ -35561,6 +35561,7 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
console.log(123);
if (!this.isValid() || BI.trim(this._lastChangedValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange();
}
@ -49697,7 +49698,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
hgap: 1,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
quitChecker: o.quitChecker,
value: o.value
});
this.clear = BI.createWidget({
type: "bi.icon_button",
@ -52211,11 +52213,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
@ -53392,11 +53394,11 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

11
dist/widget.js vendored

@ -4808,7 +4808,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
hgap: 1,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
quitChecker: o.quitChecker,
value: o.value
});
this.clear = BI.createWidget({
type: "bi.icon_button",
@ -7322,11 +7323,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;
@ -8503,11 +8504,11 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

3
src/base/single/input/input.js

@ -52,7 +52,7 @@ BI.Input = BI.inherit(BI.Single, {
_keydown(e.keyCode);
}
})
.on("input propertychange", function (e) {
.on("input", function (e) {
// 输入内容全选并直接删光,如果按键没放开就失去焦点不会触发keyup,被focusout覆盖了
// 其中propertychange在元素属性发生改变的时候就会触发 是为了兼容IE8
// 通过keyCode判断会漏掉输入法点击输入(右键粘贴暂缓)
@ -135,6 +135,7 @@ BI.Input = BI.inherit(BI.Single, {
},
onKeyDown: function (keyCode, ctrlKey) {
console.log(123);
if (!this.isValid() || BI.trim(this._lastChangedValue) !== BI.trim(this.getValue())) {
this._checkValidationOnValueChange();
}

70
src/widget/datetime/__test__/datetime.test.js

@ -35,71 +35,49 @@ describe("DateTime", function () {
/**
* test_author_windy
*/
it("trigger的confirm-下拉面板选值confirm", function (done) {
it("点击确定选值", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
height: 30
type: "bi.date_time_combo",
value: {
year: 2018,
month: 2,
day: 23,
hour: 12,
minute: 12,
second: 12
}
});
// 点击日期,是否收起下拉
dateCombo.element.find(".bi-date-time-trigger .bi-basic-button").click();
dateCombo.element.find(".bi-date-time-trigger").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(5)").parent().click();
expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").css("display")).to.equal("block");
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(16)").parent().click();
dateCombo.element.find(".bi-date-time-popup .bi-text:contains(确定)").parent().click();
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-16 12:12:12");
dateCombo.destroy();
done();
})
});
/**
* test_author_windy
*/
it("下拉后直接点击外部的触发的confirm", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
height: 30,
});
// 点击日期,是否收起下拉
BI.nextTick(function () {
dateCombo.element.find(".bi-date-time-trigger .bi-basic-button").click();
BI.nextTick(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");
dateCombo.destroy();
done();
}, 300);
});
})
});
});
/**
* test_author_windy
*/
it("点击确定", function (done) {
it("点击取消不选值", function () {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
height: 30,
type: "bi.date_time_combo",
value: {
year: 2018,
month: 2,
day: 23
day: 23,
hour: 12,
minute: 12,
second: 12
}
});
dateCombo.element.find(".bi-date-time-trigger .bi-basic-button").click();
dateCombo.element.find(".bi-date-time-trigger").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(确定)").parent().click();
expect(dateCombo.getValue()).to.deep.equal({
year: 2018,
month: 2,
day: 23
});
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(16)").parent().click();
dateCombo.element.find(".bi-date-time-popup .bi-text:contains(取消)").parent().click();
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
dateCombo.destroy();
done();
})

182
src/widget/editor/__test__/editor.search.test.js

@ -0,0 +1,182 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2019/9/9
*/
/**
* @author windy
* @version 2.0
* Created by windy on 2019/9/6
*/
describe("searchEditor", function () {
/**
* test_author_windy
*/
it("defaultValue", function (done) {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300,
value: "12345",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
expect(editor.element.find(".bi-water-mark").text()).to.equal("添加合法性判断");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
});
/**
* test_author_windy
*/
it("clear", function (done) {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300,
value: "12345",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
BI.nextTick(function () {
editor.element.find(".close-font").click();
expect(editor.element.find(".bi-input").val()).to.equal("");
editor.destroy();
done();
});
});
/**
* test_author_windy
*/
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300,
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
/**
* test_author_windy
*/
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300,
value: "12346",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
/**
* test_author_windy
*/
it("defaultValue1", function (done) {
var editor = BI.Test.createWidget({
type: "bi.small_search_editor",
width: 300,
value: "12345",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
expect(editor.element.find(".bi-water-mark").text()).to.equal("添加合法性判断");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
});
/**
* test_author_windy
*/
it("clear1", function (done) {
var editor = BI.Test.createWidget({
type: "bi.small_search_editor",
width: 300,
value: "12345",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
BI.nextTick(function () {
editor.element.find(".close-font").click();
expect(editor.element.find(".bi-input").val()).to.equal("");
editor.destroy();
done();
});
});
/**
* test_author_windy
*/
it("setValue1", function () {
var editor = BI.Test.createWidget({
type: "bi.small_search_editor",
width: 300,
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
/**
* test_author_windy
*/
it("getValue1", function () {
var editor = BI.Test.createWidget({
type: "bi.small_search_editor",
width: 300,
value: "12346",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
});

5
src/widget/editor/__test__/editor.text.test.js

@ -0,0 +1,5 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2019/9/9
*/

3
src/widget/editor/editor.search.js

@ -25,7 +25,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
hgap: 1,
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker
quitChecker: o.quitChecker,
value: o.value
});
this.clear = BI.createWidget({
type: "bi.icon_button",

4
src/widget/multilayerselecttree/multilayerselecttree.trigger.js

@ -134,11 +134,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

4
src/widget/multilayersingletree/multilayersingletree.trigger.js

@ -134,11 +134,11 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
},
_getSearchItems: function(keyword) {
var o = this.options;
var self = this, o = this.options;
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
var items = [];
this.tree.traverse(function (node) {
var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword);
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword);
if(find.find.length > 0 || find.match.length > 0) {
items.push(node);
return true;

6
test/utils.js

@ -26,10 +26,10 @@
element.trigger(e1);
// keyup 至少等300ms后触发
var e2 = $.Event("keyup");
e2.keyCode = keyCode;
element.trigger(e2);
BI.delay(function () {
var e2 = jQuery.Event("keyup");
e2.keyCode = keyCode;
element.trigger(e2);
callback();
}, 300);
},

Loading…
Cancel
Save