Browse Source

Pull request #1352: 无JIRA任务 refactor: replaceAll兼容null

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

* commit '2124feb089778e8b5ba38544979512c8c9cd1995':
  update
  无JIRA任务 refactor: replaceAll兼容null
es6
windy 4 years ago
parent
commit
2df12f1391
  1. 2
      src/component/allvaluechooser/combo.allvaluechooser.js
  2. 2
      src/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.js
  3. 2
      src/component/valuechooser/combo.valuechooser.insert.js
  4. 2
      src/component/valuechooser/combo.valuechooser.js
  5. 19
      src/core/func/__test__/string.test.js
  6. 2
      src/core/func/string.js

2
src/component/allvaluechooser/combo.allvaluechooser.js

@ -62,7 +62,7 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, {
populate: function (items) {
// 直接用combo的populate不会作用到AbstractValueChooser上
this.items = items;
this.combo.populate.apply(this, arguments);
this.combo.populate.apply(this.combo, arguments);
}
});
BI.AllValueChooserCombo.EVENT_CONFIRM = "EVENT_CONFIRM";

2
src/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.js

@ -51,7 +51,7 @@ BI.AllValueMultiTextValueCombo = BI.inherit(BI.Widget, {
populate: function (items) {
this.options.items = items;
this.combo.populate.apply(this, arguments);
this.combo.populate.apply(this.combo, arguments);
},
_digestValue: function (v) {

2
src/component/valuechooser/combo.valuechooser.insert.js

@ -80,7 +80,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
populate: function (items) {
// 直接用combo的populate不会作用到AbstractValueChooser上
this.items = items;
this.combo.populate.apply(this, arguments);
this.combo.populate.apply(this.combo, arguments);
}
});

2
src/component/valuechooser/combo.valuechooser.js

@ -84,7 +84,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
populate: function (items) {
// 直接用combo的populate不会作用到AbstractValueChooser上
this.items = items;
this.combo.populate.apply(this, arguments);
this.combo.populate.apply(this.combo, arguments);
}
});

19
src/core/func/__test__/string.test.js

@ -0,0 +1,19 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/6/5
*/
describe("dateFunctionTest", function () {
before(function () {
});
/**
* test_author_windy
*/
it("getWeekNumber", function () {
expect(BI.replaceAll(null, "A", "b")).to.equal(null);
expect(BI.replaceAll("A", "A", "b")).to.equal("b");
});
});

2
src/core/func/string.js

@ -81,7 +81,7 @@ _.extend(BI, {
* @returns {String} 替换后的字符串
*/
replaceAll: function (str, s1, s2) {
return str.replace(new RegExp(s1, "gm"), s2);
return BI.isNull(str) ? str : str.replace(new RegExp(s1, "gm"), s2);
},
/**
* 总是让字符串以指定的字符开头

Loading…
Cancel
Save