diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 46adfea4b..af36c00c7 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -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; diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index f74cc8c4a..8350988c2 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -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; diff --git a/dist/base.js b/dist/base.js index ac06e71f1..5b9f91d29 100644 --- a/dist/base.js +++ b/dist/base.js @@ -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(); } diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 46adfea4b..af36c00c7 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -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; diff --git a/dist/bundle.js b/dist/bundle.js index f74cc8c4a..8350988c2 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -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; diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index eebaa5174..11fecd5f6 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -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; diff --git a/dist/fineui.js b/dist/fineui.js index 70d91d48f..131805df5 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -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; diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 52206022d..17d587fd1 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -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; diff --git a/dist/widget.js b/dist/widget.js index e10c299dc..79a2db36c 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -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; diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js index 2b01982f4..5b9266857 100644 --- a/src/base/single/input/input.js +++ b/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(); } diff --git a/src/widget/datetime/__test__/datetime.test.js b/src/widget/datetime/__test__/datetime.test.js index be508293d..b56e7f265 100644 --- a/src/widget/datetime/__test__/datetime.test.js +++ b/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(); }) diff --git a/src/widget/editor/__test__/editor.search.test.js b/src/widget/editor/__test__/editor.search.test.js new file mode 100644 index 000000000..9e8c85d12 --- /dev/null +++ b/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(); + }); + +}); \ No newline at end of file diff --git a/src/widget/editor/__test__/editor.text.test.js b/src/widget/editor/__test__/editor.text.test.js new file mode 100644 index 000000000..de00126d1 --- /dev/null +++ b/src/widget/editor/__test__/editor.text.test.js @@ -0,0 +1,5 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2019/9/9 + */ \ No newline at end of file diff --git a/src/widget/editor/editor.search.js b/src/widget/editor/editor.search.js index 2857a8593..f6079b67c 100644 --- a/src/widget/editor/editor.search.js +++ b/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", diff --git a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js index 894957496..cd1212a2e 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js +++ b/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; diff --git a/src/widget/multilayersingletree/multilayersingletree.trigger.js b/src/widget/multilayersingletree/multilayersingletree.trigger.js index 66c350231..956e61311 100644 --- a/src/widget/multilayersingletree/multilayersingletree.trigger.js +++ b/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; diff --git a/test/utils.js b/test/utils.js index bfc35cfa7..51f9a6a32 100644 --- a/test/utils.js +++ b/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); },