Browse Source

Pull request #1545: 无JIRA任务 解决单测报错

Merge in VISUAL/fineui from ~WINDY/fui:master to master

* commit '19adce1fdba4ba29a4261e5893a10a5cb820fdad':
  无JIRA任务 解决单测报错
es6
windy 4 years ago
parent
commit
5866488ad9
  1. 6
      karma.conf.js
  2. 7
      src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js
  3. 2
      src/core/__test__/alias.test.js
  4. 19
      src/widget/multiselect/__test__/multiselect.loader.nobar.test.js
  5. 7
      src/widget/multiselectlist/__test__/multiselectlist.insert.test.js
  6. 3
      src/widget/multiselectlist/multiselectlist.insert.js

6
karma.conf.js

@ -19,11 +19,7 @@ module.exports = function (config) {
// list of files / patterns to load in the browser // list of files / patterns to load in the browser
files: [ files: [
"src/css/core/**/*.css", "dist/fineui.min.css",
"src/css/theme/**/*.css",
"src/css/base/**/*.css",
"src/css/widget/**/*.css",
"public/css/app.css",
"src/core/foundation.js", "src/core/foundation.js",
"src/core/lodash.js", "src/core/lodash.js",
"src/core/base.js", "src/core/base.js",

7
src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js

@ -6,13 +6,16 @@
describe("search_text_value_combo", function () { describe("search_text_value_combo", function () {
var items = BI.map(BI.makeArray(100, null), function(idx, v) { var items;
before(function () {
items = BI.map(BI.makeArray(100, null), function(idx, v) {
return { return {
text: idx, text: idx,
value: idx, value: idx,
title: idx title: idx
}; };
}); });
});
/** /**
* test_author_windy * test_author_windy
@ -77,7 +80,7 @@ describe("search_text_value_combo", function () {
BI.nextTick(function () { BI.nextTick(function () {
BI.Test.triggerKeyDown(widget.element.find(".bi-search-text-value-trigger .bi-input"), "2", 50, function () { BI.Test.triggerKeyDown(widget.element.find(".bi-search-text-value-trigger .bi-input"), "2", 50, function () {
BI.nextTick(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); expect(widget.getValue()[0]).to.deep.equal(2);
widget.destroy(); widget.destroy();
done(); done();

2
src/core/__test__/alias.test.js

@ -18,7 +18,7 @@ describe("aliasFunctionTest", function () {
var targetString = "<a>1 2&</a>"; var targetString = "<a>1 2&</a>";
var encodeString = BI.htmlEncode(targetString); var encodeString = BI.htmlEncode(targetString);
expect(encodeString).to.equal("&lt;a&gt;1 2&amp;&lt;/a&gt;"); expect(encodeString).to.equal("&lt;a&gt;1&nbsp;2&amp;&lt;/a&gt;");
expect(BI.htmlDecode(encodeString)).to.equal(targetString); expect(BI.htmlDecode(encodeString)).to.equal(targetString);
}); });

19
src/widget/multiselect/__test__/multiselect.loader.nobar.test.js

@ -6,7 +6,9 @@
describe("multi_select_no_bar_series", function () { describe("multi_select_no_bar_series", function () {
var _getItemsByTimes = function (items, times) { var _getItemsByTimes, _itemsCreator, itemSelectorGetter, searchItemSelectorGetter, _hasNextByTimes, items;
before(function () {
_getItemsByTimes = function (items, times) {
var res = []; var res = [];
for (var i = (times - 1) * 100; items[i] && i < times * 100; i++) { for (var i = (times - 1) * 100; items[i] && i < times * 100; i++) {
res.push(items[i]); res.push(items[i]);
@ -14,11 +16,11 @@ describe("multi_select_no_bar_series", function () {
return res; return res;
}; };
var _hasNextByTimes = function (items, times) { _hasNextByTimes = function (items, times) {
return times * 100 < items.length; return times * 100 < items.length;
}; };
var _itemsCreator = function (options, callback) { _itemsCreator = function (options, callback) {
var items = BI.map(BI.makeArray(100, null), function(idx, v) { var items = BI.map(BI.makeArray(100, null), function(idx, v) {
return { return {
text: idx, text: idx,
@ -56,18 +58,20 @@ describe("multi_select_no_bar_series", function () {
}); });
}; };
var itemSelectorGetter = function (array) { itemSelectorGetter = function (array) {
return BI.map(array, function (idx, num) { 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 + ")"; return ".bi-multi-select-popup-view .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")";
}); });
}; };
var searchItemSelectorGetter = function (array) { searchItemSelectorGetter = function (array) {
return BI.map(array, function (idx, num) { 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 + ")"; return ".bi-multi-select-search-pane .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")";
}); });
}; };
})
/** /**
* test_author_windy * test_author_windy
**/ **/
@ -159,7 +163,10 @@ describe("multi_select_no_bar_series", function () {
type: "bi.multi_select_no_bar_combo", type: "bi.multi_select_no_bar_combo",
width: 220, width: 220,
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
callback(items); callback({
items: items,
hasNext: false
});
}, },
value: [1, 2] value: [1, 2]
}); });

7
src/widget/multiselectlist/__test__/multiselectlist.insert.test.js

@ -144,6 +144,13 @@ describe("multi_list_insert_pane", function () {
type: "bi.multi_select_insert_list", type: "bi.multi_select_insert_list",
width: 220, width: 220,
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
if (op.keywords) {
callback({
items: [],
hasNext: false
})
return;
}
callback({ callback({
items: items, items: items,
hasNext: false hasNext: false

3
src/widget/multiselectlist/multiselectlist.insert.js

@ -15,7 +15,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
BI.MultiSelectInsertList.superclass._init.apply(this, arguments); BI.MultiSelectInsertList.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = o.value || {}; this.storeValue = this._assertValue(o.value || {});
var assertShowValue = function () { 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)); 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 || (val = {});
val.type || (val.type = BI.Selection.Multi); val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []); val.value || (val.value = []);
return val;
}, },
_makeMap: function (values) { _makeMap: function (values) {

Loading…
Cancel
Save