From dc7ae89908e88013da7381ac7e50659f4e448327 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 18 May 2020 15:37:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20clear=5Fedito?= =?UTF-8?q?r=E4=B9=9F=E6=94=B9=E5=8F=96=E5=80=BC=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/editor/__test__/editor.clear.test.js | 18 ++++++++++++++++++ src/case/editor/editor.clear.js | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/case/editor/__test__/editor.clear.test.js b/src/case/editor/__test__/editor.clear.test.js index 1eea576e8..7181a769e 100644 --- a/src/case/editor/__test__/editor.clear.test.js +++ b/src/case/editor/__test__/editor.clear.test.js @@ -89,4 +89,22 @@ describe("clear_editor", function () { 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(); + }); + }); \ No newline at end of file diff --git a/src/case/editor/editor.clear.js b/src/case/editor/editor.clear.js index 8c6c0f591..372d31bdd 100644 --- a/src/case/editor/editor.clear.js +++ b/src/case/editor/editor.clear.js @@ -144,8 +144,7 @@ BI.ClearEditor = BI.inherit(BI.Widget, { getValue: function () { if (this.isValid()) { - var res = this.editor.getValue().match(/[\S]+/g); - return BI.isNull(res) ? "" : res[res.length - 1]; + return this.editor.getValue(); } },