diff --git a/src/base/single/__test__/text.test.js b/src/base/single/__test__/text.test.js index 0aa659ac62..9549b2d7e5 100644 --- a/src/base/single/__test__/text.test.js +++ b/src/base/single/__test__/text.test.js @@ -154,4 +154,42 @@ describe("TextTest", function () { done(); }); }); + + /** + * test_author_windy + */ + it("text的value属性", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "", + value: "aaaa" + }); + expect(text.element.text()).to.equal(""); + text.destroy(); + }); + + /** + * test_author_windy + */ + it("text的value属性1", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + value: "aaaa" + }); + expect(text.element.text()).to.equal("aaaa"); + text.destroy(); + }); + + /** + * test_author_windy + */ + it("text的value属性2", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + text: null, + value: "aaaa" + }); + expect(text.element.text()).to.equal(""); + text.destroy(); + }); }); diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index 5240f83e07..fb2f87656b 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -11,7 +11,6 @@ BI.BasicButton = BI.inherit(BI.Single, { return BI.extend(conf, { _baseCls: (conf._baseCls || "") + " bi-basic-button" + (conf.invalid ? "" : " cursor-pointer") + ((BI.isIE() && BI.getIEVersion() < 10) ? " hack" : ""), value: "", - text: "", stopEvent: false, stopPropagation: false, selected: false, diff --git a/src/base/single/label/abstract.label.js b/src/base/single/label/abstract.label.js index 2dc09c826f..9bf8b9a200 100644 --- a/src/base/single/label/abstract.label.js +++ b/src/base/single/label/abstract.label.js @@ -17,7 +17,6 @@ rgap: 0, tgap: 0, bgap: 0, - text: "", highLight: false, handler: null }); diff --git a/src/base/single/text.js b/src/base/single/text.js index 639599d91f..d300c821fe 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -18,7 +18,6 @@ rgap: 0, tgap: 0, bgap: 0, - text: "", py: "", highLight: false }, @@ -78,8 +77,10 @@ } var text = this._getShowText(); - if (BI.isKey(text)) { + if (!BI.isUndefined(text)) { this.setText(text); + } else if (BI.isKey(o.value)) { + this.setText(o.value); } if (BI.isKey(o.keyword)) { this.doRedMark(o.keyword); @@ -103,10 +104,8 @@ _getShowText: function () { var o = this.options; var text = BI.isFunction(o.text) ? o.text() : o.text; - if (!BI.isKey(text)) { - return ""; - } - return BI.Text.formatText(text + ""); + + return BI.isKey(text) ? BI.Text.formatText(text + "") : text; }, _doRedMark: function (keyword) {