Browse Source

无JIRA任务 clear_editor也改取值方式

es6
windy 5 years ago
parent
commit
dc7ae89908
  1. 18
      src/case/editor/__test__/editor.clear.test.js
  2. 3
      src/case/editor/editor.clear.js

18
src/case/editor/__test__/editor.clear.test.js

@ -89,4 +89,22 @@ describe("clear_editor", function () {
editor.destroy(); editor.destroy();
}); });
/**
* test_author_windy
*/
it("getValue1", function () {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
value: "12346 7890",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).to.equal("12346 7890");
editor.destroy();
});
}); });

3
src/case/editor/editor.clear.js

@ -144,8 +144,7 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
getValue: function () { getValue: function () {
if (this.isValid()) { if (this.isValid()) {
var res = this.editor.getValue().match(/[\S]+/g); return this.editor.getValue();
return BI.isNull(res) ? "" : res[res.length - 1];
} }
}, },

Loading…
Cancel
Save