iapyang
4 years ago
59 changed files with 5546 additions and 4217 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,43 @@ |
|||||||
|
/** |
||||||
|
* 没有html标签的纯文本 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
BI.PureText = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: { |
||||||
|
tagName: null |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
var self = this, o = this.options; |
||||||
|
var text = this._getShowText(); |
||||||
|
if (BI.isKey(text)) { |
||||||
|
this.setText(text); |
||||||
|
} else if (BI.isKey(o.value)) { |
||||||
|
this.setText(o.value); |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
_getShowText: function () { |
||||||
|
var o = this.options; |
||||||
|
var text = BI.isFunction(o.text) ? o.text() : o.text; |
||||||
|
text = BI.isKey(text) ? text : o.value; |
||||||
|
if (!BI.isKey(text)) { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
return BI.Text.formatText(text + ""); |
||||||
|
}, |
||||||
|
|
||||||
|
setValue: function (value) { |
||||||
|
this.options.value = value; |
||||||
|
this.setText(value); |
||||||
|
}, |
||||||
|
|
||||||
|
setText: function (text) { |
||||||
|
this.options.text = BI.isNotNull(text) ? text : ""; |
||||||
|
this.element.__textKeywordMarked__(this._getShowText()); |
||||||
|
} |
||||||
|
}); |
||||||
|
BI.shortcut("bi.pure_text", BI.PureText); |
||||||
|
}()); |
||||||
|
|
@ -0,0 +1,38 @@ |
|||||||
|
/** |
||||||
|
* Created by guy on 2018/01/23. |
||||||
|
*/ |
||||||
|
describe("widgetTest", function () { |
||||||
|
|
||||||
|
before(function () { |
||||||
|
}); |
||||||
|
|
||||||
|
/** |
||||||
|
* test_author_guy |
||||||
|
*/ |
||||||
|
it("widget生命周期测试", function () { |
||||||
|
|
||||||
|
var Demo = BI.inherit(BI.Widget, { |
||||||
|
render: function () { |
||||||
|
return { |
||||||
|
type: "bi.label", |
||||||
|
text: "old" |
||||||
|
}; |
||||||
|
} |
||||||
|
}); |
||||||
|
BI.shortcut("demo.demo", Demo); |
||||||
|
|
||||||
|
var demo = BI.Test.createWidget({ |
||||||
|
type: "demo.demo", |
||||||
|
render: function () { |
||||||
|
return { |
||||||
|
type: "bi.label", |
||||||
|
text: "new" |
||||||
|
}; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
expect(demo.element.text()).to.equal("new"); |
||||||
|
demo.destroy(); |
||||||
|
}); |
||||||
|
|
||||||
|
}); |
Loading…
Reference in new issue