From 19adce1fdba4ba29a4261e5893a10a5cb820fdad Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 15 Oct 2020 18:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=8D=95=E6=B5=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- karma.conf.js | 6 +- .../combo.searchtextvaluecombo.test.js | 17 +-- src/core/__test__/alias.test.js | 2 +- .../__test__/multiselect.loader.nobar.test.js | 117 ++++++++++-------- .../__test__/multiselectlist.insert.test.js | 7 ++ .../multiselectlist/multiselectlist.insert.js | 3 +- 6 files changed, 83 insertions(+), 69 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index 2ab764d6d..4c8850be5 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -19,11 +19,7 @@ module.exports = function (config) { // list of files / patterns to load in the browser files: [ - "src/css/core/**/*.css", - "src/css/theme/**/*.css", - "src/css/base/**/*.css", - "src/css/widget/**/*.css", - "public/css/app.css", + "dist/fineui.min.css", "src/core/foundation.js", "src/core/lodash.js", "src/core/base.js", diff --git a/src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js b/src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js index 47390ba16..0b66b13ed 100644 --- a/src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js +++ b/src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js @@ -6,12 +6,15 @@ describe("search_text_value_combo", function () { - var items = BI.map(BI.makeArray(100, null), function(idx, v) { - return { - text: idx, - value: idx, - title: idx - }; + var items; + before(function () { + items = BI.map(BI.makeArray(100, null), function(idx, v) { + return { + text: idx, + value: idx, + title: idx + }; + }); }); /** @@ -77,7 +80,7 @@ describe("search_text_value_combo", function () { BI.nextTick(function () { BI.Test.triggerKeyDown(widget.element.find(".bi-search-text-value-trigger .bi-input"), "2", 50, function () { BI.nextTick(function () { - widget.element.find(".bi-search-text-value-popup .bi-single-select-item").click(); + widget.element.find(".bi-search-text-value-popup .bi-single-select-item")[0].click(); expect(widget.getValue()[0]).to.deep.equal(2); widget.destroy(); done(); diff --git a/src/core/__test__/alias.test.js b/src/core/__test__/alias.test.js index 9c2a1920e..5416bd957 100644 --- a/src/core/__test__/alias.test.js +++ b/src/core/__test__/alias.test.js @@ -18,7 +18,7 @@ describe("aliasFunctionTest", function () { var targetString = "1 2&"; var encodeString = BI.htmlEncode(targetString); - expect(encodeString).to.equal("<a>1 2&</a>"); + expect(encodeString).to.equal("<a>1 2&</a>"); expect(BI.htmlDecode(encodeString)).to.equal(targetString); }); diff --git a/src/widget/multiselect/__test__/multiselect.loader.nobar.test.js b/src/widget/multiselect/__test__/multiselect.loader.nobar.test.js index f73e9be16..a7750bb26 100644 --- a/src/widget/multiselect/__test__/multiselect.loader.nobar.test.js +++ b/src/widget/multiselect/__test__/multiselect.loader.nobar.test.js @@ -6,67 +6,71 @@ describe("multi_select_no_bar_series", function () { - var _getItemsByTimes = function (items, times) { - var res = []; - for (var i = (times - 1) * 100; items[i] && i < times * 100; i++) { - res.push(items[i]); - } - return res; - }; + var _getItemsByTimes, _itemsCreator, itemSelectorGetter, searchItemSelectorGetter, _hasNextByTimes, items; + before(function () { + _getItemsByTimes = function (items, times) { + var res = []; + for (var i = (times - 1) * 100; items[i] && i < times * 100; i++) { + res.push(items[i]); + } + return res; + }; - var _hasNextByTimes = function (items, times) { - return times * 100 < items.length; - }; + _hasNextByTimes = function (items, times) { + return times * 100 < items.length; + }; - var _itemsCreator = function (options, callback) { - var items = BI.map(BI.makeArray(100, null), function(idx, v) { - return { - text: idx, - value: idx, - title: idx - }; - }); - var keywords = (options.keywords || []).slice(); - if (options.keyword) { - keywords.push(options.keyword); - } - BI.each(keywords, function (i, kw) { - var search = BI.Func.getSearchResult(items, kw); - items = search.match.concat(search.find); - }); - if (options.selectedValues) {// 过滤 - var filter = BI.makeObject(options.selectedValues, true); - items = BI.filter(items, function (i, ob) { - return !filter[ob.value]; + _itemsCreator = function (options, callback) { + var items = BI.map(BI.makeArray(100, null), function(idx, v) { + return { + text: idx, + value: idx, + title: idx + }; + }); + var keywords = (options.keywords || []).slice(); + if (options.keyword) { + keywords.push(options.keyword); + } + BI.each(keywords, function (i, kw) { + var search = BI.Func.getSearchResult(items, kw); + items = search.match.concat(search.find); }); - } - if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + if (options.selectedValues) {// 过滤 + var filter = BI.makeObject(options.selectedValues, true); + items = BI.filter(items, function (i, ob) { + return !filter[ob.value]; + }); + } + if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + callback({ + items: items + }); + return; + } + if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + callback({count: items.length}); + return; + } callback({ - items: items + items: _getItemsByTimes(items, options.times), + hasNext: _hasNextByTimes(items, options.times) }); - return; - } - if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { - callback({count: items.length}); - return; - } - callback({ - items: _getItemsByTimes(items, options.times), - hasNext: _hasNextByTimes(items, options.times) - }); - }; + }; - var itemSelectorGetter = function (array) { - return BI.map(array, function (idx, num) { - return ".bi-multi-select-popup-view .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; - }); - }; + itemSelectorGetter = function (array) { + return BI.map(array, function (idx, num) { + return ".bi-multi-select-popup-view .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; + }); + }; - var searchItemSelectorGetter = function (array) { - return BI.map(array, function (idx, num) { - return ".bi-multi-select-search-pane .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; - }); - }; + searchItemSelectorGetter = function (array) { + return BI.map(array, function (idx, num) { + return ".bi-multi-select-search-pane .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; + }); + }; + + }) /** * test_author_windy @@ -159,7 +163,10 @@ describe("multi_select_no_bar_series", function () { type: "bi.multi_select_no_bar_combo", width: 220, itemsCreator: function (op, callback) { - callback(items); + callback({ + items: items, + hasNext: false + }); }, value: [1, 2] }); diff --git a/src/widget/multiselectlist/__test__/multiselectlist.insert.test.js b/src/widget/multiselectlist/__test__/multiselectlist.insert.test.js index 729791ce9..9fd2d0385 100644 --- a/src/widget/multiselectlist/__test__/multiselectlist.insert.test.js +++ b/src/widget/multiselectlist/__test__/multiselectlist.insert.test.js @@ -144,6 +144,13 @@ describe("multi_list_insert_pane", function () { type: "bi.multi_select_insert_list", width: 220, itemsCreator: function (op, callback) { + if (op.keywords) { + callback({ + items: [], + hasNext: false + }) + return; + } callback({ items: items, hasNext: false diff --git a/src/widget/multiselectlist/multiselectlist.insert.js b/src/widget/multiselectlist/multiselectlist.insert.js index 92997febe..9aaa11cab 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.js +++ b/src/widget/multiselectlist/multiselectlist.insert.js @@ -15,7 +15,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { BI.MultiSelectInsertList.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.storeValue = o.value || {}; + this.storeValue = this._assertValue(o.value || {}); var assertShowValue = function () { BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue)); @@ -213,6 +213,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { val || (val = {}); val.type || (val.type = BI.Selection.Multi); val.value || (val.value = []); + return val; }, _makeMap: function (values) {