diff --git a/.eslintrc b/.eslintrc index a0374a47e..70d386082 100644 --- a/.eslintrc +++ b/.eslintrc @@ -31,7 +31,8 @@ "rules": { "no-param-reassign": "off", "quotes": [2, "double"], - "comma-dangle": ["error", { "arrays": "never", "objects": "always"}], // 多行对象字面量中要求拖尾逗号 + "comma-dangle": ["error", { "arrays": "never", "objects": "always-multiline"}] // 多行对象字面量中要求拖尾逗号 + // "no-empty": ["error",{"allowEmptyCatch":"true"}] } }, { "files": ["webpack/*.js", "./*.js", "lib/**/*.js", "lib/*.js", "./bin/*.js", "./bin/**/*.js"], diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index f6bbcc774..0ad681faa 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -282,7 +282,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { var minY = BI.max(topBorder); var maxY = BI.min(bottomBorder); - this.renderRange = { minX: minX, minY: minY, maxX: maxX, maxY: maxY, }; + this.renderRange = { minX: minX, minY: minY, maxX: maxX, maxY: maxY }; } }, @@ -341,7 +341,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { if (this.options.overflowX !== !!b) { this.options.overflowX = !!b; BI.nextTick(function () { - self.element.css({ overflowX: b ? "auto" : "hidden", }); + self.element.css({ overflowX: b ? "auto" : "hidden" }); }); } }, @@ -351,7 +351,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { if (this.options.overflowY !== !!b) { this.options.overflowY = !!b; BI.nextTick(function () { - self.element.css({ overflowY: b ? "auto" : "hidden", }); + self.element.css({ overflowY: b ? "auto" : "hidden" }); }); } }, diff --git a/src/base/combination/bubble.js b/src/base/combination/bubble.js index 0e8a79673..d4c240b17 100644 --- a/src/base/combination/bubble.js +++ b/src/base/combination/bubble.js @@ -85,7 +85,7 @@ element: this, }, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, { items: [ - { el: this.combo, } + { el: this.combo } ], })))); o.isDefaultInit && (this._assertPopupView()); @@ -260,7 +260,7 @@ scrolly: false, element: this.options.container || this, items: [ - { el: this.popupView, } + { el: this.popupView } ], }); this._rendered = true; diff --git a/src/base/combination/expander.js b/src/base/combination/expander.js index 5e99dacbd..60b3dd471 100644 --- a/src/base/combination/expander.js +++ b/src/base/combination/expander.js @@ -65,7 +65,7 @@ BI.Expander = BI.inherit(BI.Widget, { scrolly: false, element: this, items: [ - { el: this.expander, } + { el: this.expander } ], }); o.isDefaultInit && this._assertPopupView(); @@ -171,7 +171,7 @@ BI.Expander = BI.inherit(BI.Widget, { scrolly: false, element: this, items: [ - { el: this.popupView, } + { el: this.popupView } ], }); this._rendered = true; diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js index aa73851a6..49d56167c 100644 --- a/src/base/combination/group.button.js +++ b/src/base/combination/group.button.js @@ -203,7 +203,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { items = this._packageItems(items, this._packageBtns(this.buttons)); } - this.layouts = BI.createWidget(BI.extend({ element: this, }, this._packageLayout(items))); + this.layouts = BI.createWidget(BI.extend({ element: this }, this._packageLayout(items))); }, setNotSelectedValue: function (v) { diff --git a/src/base/combination/group.combo.js b/src/base/combination/group.combo.js index 1b77ddc3a..2f8b0c72e 100644 --- a/src/base/combination/group.combo.js +++ b/src/base/combination/group.combo.js @@ -15,7 +15,7 @@ BI.ComboGroup = BI.inherit(BI.Widget, { isNeedAdjustHeight: false, isNeedAdjustWidth: false, - el: { type: "bi.text_button", text: "", value: "", }, + el: { type: "bi.text_button", text: "", value: "" }, items: [], popup: { diff --git a/src/base/combination/group.virtual.js b/src/base/combination/group.virtual.js index a6f481a9d..40e7c09f4 100644 --- a/src/base/combination/group.virtual.js +++ b/src/base/combination/group.virtual.js @@ -132,7 +132,7 @@ BI.VirtualGroup = BI.inherit(BI.Widget, { this.options.items = items; items = this._packageBtns(items); if (!this.layouts) { - this.layouts = BI.createWidget(BI.extend({ element: this, }, this._packageLayout(items))); + this.layouts = BI.createWidget(BI.extend({ element: this }, this._packageLayout(items))); } else { this.layouts.populate(items, { context: this, diff --git a/src/base/combination/loader.js b/src/base/combination/loader.js index a666fda1a..cf548b024 100644 --- a/src/base/combination/loader.js +++ b/src/base/combination/loader.js @@ -38,7 +38,7 @@ BI.Loader = BI.inherit(BI.Widget, { _prevLoad: function () { var self = this, o = this.options; this.prev.setLoading(); - o.itemsCreator.apply(this, [{ times: --this.times, }, function () { + o.itemsCreator.apply(this, [{ times: --this.times }, function () { self.prev.setLoaded(); self.prependItems.apply(self, arguments); }]); @@ -47,7 +47,7 @@ BI.Loader = BI.inherit(BI.Widget, { _nextLoad: function () { var self = this, o = this.options; this.next.setLoading(); - o.itemsCreator.apply(this, [{ times: ++this.times, }, function () { + o.itemsCreator.apply(this, [{ times: ++this.times }, function () { self.next.setLoaded(); self.addItems.apply(self, arguments); }]); @@ -170,7 +170,7 @@ BI.Loader = BI.inherit(BI.Widget, { _populate: function (items) { var self = this, o = this.options; if (arguments.length === 0 && (BI.isFunction(o.itemsCreator))) { - o.itemsCreator.apply(this, [{ times: 1, }, function () { + o.itemsCreator.apply(this, [{ times: 1 }, function () { if (arguments.length === 0) { throw new Error("参数不能为空"); } diff --git a/src/base/combination/navigation.js b/src/base/combination/navigation.js index 5004a660e..971ec9ba9 100644 --- a/src/base/combination/navigation.js +++ b/src/base/combination/navigation.js @@ -23,7 +23,7 @@ BI.Navigation = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; - this.tab = BI.createWidget(this.options.tab, { type: "bi.button_group", }); + this.tab = BI.createWidget(this.options.tab, { type: "bi.button_group" }); this.cardMap = {}; this.showIndex = 0; this.layout = BI.createWidget({ diff --git a/src/base/combination/tab.js b/src/base/combination/tab.js index 196c90850..fe5904804 100644 --- a/src/base/combination/tab.js +++ b/src/base/combination/tab.js @@ -23,7 +23,7 @@ BI.Tab = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; if (BI.isObject(o.tab)) { - this.tab = BI.createWidget(this.options.tab, { type: "bi.button_group", }); + this.tab = BI.createWidget(this.options.tab, { type: "bi.button_group" }); this.tab.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); diff --git a/src/base/foundation/message.js b/src/base/foundation/message.js index 76d82f5e5..380e12039 100644 --- a/src/base/foundation/message.js +++ b/src/base/foundation/message.js @@ -21,7 +21,7 @@ BI.Msg = ((function () { // BI.Msg.prompt(title, message, value, callback, min_width); }, toast: function (message, options, context) { - BI.isString(options) && (options = { level: options, }); + BI.isString(options) && (options = { level: options }); options = options || {}; context = context || BI.Widget._renderEngine.createElement("body"); var level = options.level || "common"; @@ -40,7 +40,7 @@ BI.Msg = ((function () { BI.remove(toastStack, toast.element); var _height = BI.SIZE_CONSANTS.TOAST_TOP; BI.each(toastStack, function (i, element) { - element.css({ "top": _height, }); + element.css({ "top": _height }); _height += element.outerHeight() + 10; }); callback(); @@ -61,7 +61,7 @@ BI.Msg = ((function () { }], }); toastStack.push(toast.element); - toast.element.css({ "margin-left": -1 * toast.element.outerWidth() / 2, }); + toast.element.css({ "margin-left": -1 * toast.element.outerWidth() / 2 }); toast.element.removeClass("bi-message-leave").addClass("bi-message-enter"); autoClose && BI.delay(function () { diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index dc6e8506d..81853b77a 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -258,7 +258,7 @@ BI.GridView = BI.inherit(BI.Widget, { this.container.attr("items", renderedCells); this.renderedCells = renderedCells; this.renderedKeys = renderedKeys; - this.renderRange = { minX: minX, minY: minY, maxX: maxX, maxY: maxY, }; + this.renderRange = { minX: minX, minY: minY, maxX: maxX, maxY: maxY }; } }, @@ -333,7 +333,7 @@ BI.GridView = BI.inherit(BI.Widget, { if (this.options.overflowX !== !!b) { this.options.overflowX = !!b; BI.nextTick(function () { - self.element.css({ overflowX: b ? "auto" : "hidden", }); + self.element.css({ overflowX: b ? "auto" : "hidden" }); }); } }, @@ -343,7 +343,7 @@ BI.GridView = BI.inherit(BI.Widget, { if (this.options.overflowY !== !!b) { this.options.overflowY = !!b; BI.nextTick(function () { - self.element.css({ overflowY: b ? "auto" : "hidden", }); + self.element.css({ overflowY: b ? "auto" : "hidden" }); }); } }, diff --git a/src/base/layer/layer.drawer.js b/src/base/layer/layer.drawer.js index af6eb98c2..23ef8b8c5 100644 --- a/src/base/layer/layer.drawer.js +++ b/src/base/layer/layer.drawer.js @@ -227,7 +227,7 @@ BI.Drawer = BI.inherit(BI.Widget, { }, setZindex: function (zindex) { - this.element.css({ "z-index": zindex, }); + this.element.css({ "z-index": zindex }); }, destroyed: function () { diff --git a/src/base/layer/layer.popover.js b/src/base/layer/layer.popover.js index a6caefd85..2a4453472 100644 --- a/src/base/layer/layer.popover.js +++ b/src/base/layer/layer.popover.js @@ -222,7 +222,7 @@ BI.Popover = BI.inherit(BI.Widget, { }, setZindex: function (zindex) { - this.element.css({ "z-index": zindex, }); + this.element.css({ "z-index": zindex }); }, destroyed: function () { diff --git a/src/base/layer/layer.popup.js b/src/base/layer/layer.popup.js index d4291ef95..ef7d55749 100644 --- a/src/base/layer/layer.popup.js +++ b/src/base/layer/layer.popup.js @@ -62,12 +62,12 @@ BI.PopupView = BI.inherit(BI.Widget, { "z-index": BI.zIndex_popup, "min-width": BI.isNumeric(o.minWidth) ? (o.minWidth / BI.pixRatio + BI.pixUnit) : o.minWidth, "max-width": BI.isNumeric(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth, - }).bind({ click: fn, }); + }).bind({ click: fn }); this.element.bind("mousewheel", fn); - o.stopPropagation && this.element.bind({ mousedown: fn, mouseup: fn, mouseover: fn, }); - o.stopEvent && this.element.bind({ mousedown: stop, mouseup: stop, mouseover: stop, }); + o.stopPropagation && this.element.bind({ mousedown: fn, mouseup: fn, mouseover: fn }); + o.stopEvent && this.element.bind({ mousedown: stop, mouseup: stop, mouseover: stop }); this.tool = this._createTool(); this.tab = this._createTab(); this.view = this._createView(); @@ -133,7 +133,7 @@ BI.PopupView = BI.inherit(BI.Widget, { _createView: function () { var o = this.options; - this.button_group = BI.createWidget(o.el, { type: "bi.button_group", value: o.value, }); + this.button_group = BI.createWidget(o.el, { type: "bi.button_group", value: o.value }); this.button_group.element.css({ "min-height": BI.isNumeric(o.minHeight) ? (o.minHeight / BI.pixRatio + BI.pixUnit) : o.minHeight, "padding-top": o.innerVgap / BI.pixRatio + BI.pixUnit, @@ -411,7 +411,7 @@ BI.PopupView = BI.inherit(BI.Widget, { toolHeight = ((this.tool && this.tool.attr("height")) || 24) * ((this.tool && this.tool.isVisible()) ? 1 : 0); var resetHeight = h - tbHeight - tabHeight - toolHeight - 2 * this.options.innerVgap; this.view.resetHeight ? this.view.resetHeight(resetHeight) : - this.view.element.css({ "max-height": resetHeight / BI.pixRatio + BI.pixUnit, }); + this.view.element.css({ "max-height": resetHeight / BI.pixRatio + BI.pixUnit }); }, setValue: function (selectedValues) { diff --git a/src/base/single/1.text.js b/src/base/single/1.text.js index 123df54a3..50aebf841 100644 --- a/src/base/single/1.text.js +++ b/src/base/single/1.text.js @@ -45,13 +45,13 @@ }); } if (BI.isWidthOrHeight(o.height)) { - this.element.css({ lineHeight: BI.isNumber(o.height) ? (o.height / BI.pixRatio + BI.pixUnit) : o.height, }); + this.element.css({ lineHeight: BI.isNumber(o.height) ? (o.height / BI.pixRatio + BI.pixUnit) : o.height }); } if (BI.isWidthOrHeight(o.lineHeight)) { - this.element.css({ lineHeight: BI.isNumber(o.lineHeight) ? (o.lineHeight / BI.pixRatio + BI.pixUnit) : o.lineHeight, }); + this.element.css({ lineHeight: BI.isNumber(o.lineHeight) ? (o.lineHeight / BI.pixRatio + BI.pixUnit) : o.lineHeight }); } if (BI.isWidthOrHeight(o.maxWidth)) { - this.element.css({ maxWidth: BI.isNumber(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth, }); + this.element.css({ maxWidth: BI.isNumber(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth }); } this.element.css({ textAlign: o.textAlign, diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index 9ade43edb..8fa304890 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -8,6 +8,7 @@ BI.BasicButton = BI.inherit(BI.Single, { _defaultConfig: function () { var conf = BI.BasicButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { _baseCls: (conf._baseCls || "") + " bi-basic-button" + (conf.invalid ? "" : " cursor-pointer") + ((BI.isIE() && BI.getIEVersion() < 10) ? " hack" : ""), // el: {} // 可以通过el来创建button元素 @@ -21,10 +22,10 @@ BI.BasicButton = BI.inherit(BI.Single, { disableSelected: false, // 使能选中 shadow: false, - isShadowShowingOnSelected: false, // 选中状态下是否显示阴影 + isShadowShowingOnSelected: false, // 选中状态下是否显示阴影 trigger: null, handler: BI.emptyFn, - bubble: null + bubble: null, }); }, @@ -63,11 +64,11 @@ BI.BasicButton = BI.inherit(BI.Single, { _createShadow: function () { var self = this, o = this.options; - var assertMask = function () { + function assertMask() { if (!self.$mask) { self.$mask = BI.createWidget(BI.isObject(o.shadow) ? o.shadow : {}, { type: "bi.layout", - cls: "bi-button-mask" + cls: "bi-button-mask", }); self.$mask.invisible(); BI.createWidget({ @@ -78,11 +79,11 @@ BI.BasicButton = BI.inherit(BI.Single, { left: 0, right: 0, top: 0, - bottom: 0 - }] + bottom: 0, + }], }); } - }; + } this.element.mouseup(function () { if (!self._hover && !o.isShadowShowingOnSelected) { @@ -223,7 +224,7 @@ BI.BasicButton = BI.inherit(BI.Single, { // 之后的300ms点击无效 var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, { "leading": true, - "trailing": false + "trailing": false, }); function ev(e) { @@ -257,7 +258,7 @@ BI.BasicButton = BI.inherit(BI.Single, { }, el: { type: "bi.layout", - height: "100%" + height: "100%", }, popup: { type: "bi.text_bubble_bar_popup_view", @@ -272,21 +273,21 @@ BI.BasicButton = BI.inherit(BI.Single, { if (v) { onClick.apply(self, arguments); } - } - }] + }, + }], }, listeners: [{ eventName: BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW, action: function () { popup.populate(getBubble()); - } - }] + }, + }], }, left: 0, right: 0, bottom: 0, - top: 0 - }] + top: 0, + }], }); } if (self.combo.isViewVisible()) { @@ -294,6 +295,7 @@ BI.BasicButton = BI.inherit(BI.Single, { } else { self.combo.showView(); } + return; } onClick.apply(self, arguments); @@ -304,6 +306,7 @@ BI.BasicButton = BI.inherit(BI.Single, { if (BI.isFunction(bubble)) { return bubble(); } + return bubble; } }, @@ -436,7 +439,7 @@ BI.BasicButton = BI.inherit(BI.Single, { empty: function () { BI.Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); BI.BasicButton.superclass.empty.apply(this, arguments); - } + }, }); BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; BI.shortcut("bi.basic_button", BI.BasicButton); diff --git a/src/base/single/button/button.node.js b/src/base/single/button/button.node.js index 8e17a4ea5..744cfe28f 100644 --- a/src/base/single/button/button.node.js +++ b/src/base/single/button/button.node.js @@ -9,9 +9,10 @@ BI.NodeButton = BI.inherit(BI.BasicButton, { _defaultConfig: function () { var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { _baseCls: (conf._baseCls || "") + " bi-node", - open: false + open: false, }); }, @@ -51,6 +52,6 @@ BI.NodeButton = BI.inherit(BI.BasicButton, { this.setOpened(true); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); } - } + }, }); BI.shortcut("bi.node_button", BI.NodeButton); diff --git a/src/base/single/button/node/__test__/icontexticonnode.test.js b/src/base/single/button/node/__test__/icontexticonnode.test.js index ae2a8fbb4..b76324283 100644 --- a/src/base/single/button/node/__test__/icontexticonnode.test.js +++ b/src/base/single/button/node/__test__/icontexticonnode.test.js @@ -4,13 +4,12 @@ */ describe("IconTextIconNodeTest", function () { - /** * test_author_kobi */ it("setText", function () { var iconTextIconNode = BI.Test.createWidget({ - type: "bi.icon_text_icon_node" + type: "bi.icon_text_icon_node", }); iconTextIconNode.setText("AAA"); expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA"); @@ -34,7 +33,7 @@ describe("IconTextIconNodeTest", function () { */ it("setValue", function () { var iconTextIconNode = BI.Test.createWidget({ - type: "bi.icon_text_icon_node" + type: "bi.icon_text_icon_node", }); iconTextIconNode.setValue("AAA"); expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA"); @@ -48,7 +47,7 @@ describe("IconTextIconNodeTest", function () { var iconTextIconNode = BI.Test.createWidget({ type: "bi.icon_text_icon_node", value: "AAA", - readonly: true + readonly: true, }); iconTextIconNode.setValue("BBB"); expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA"); @@ -61,7 +60,7 @@ describe("IconTextIconNodeTest", function () { it("getValue", function () { var iconTextIconNode = BI.Test.createWidget({ type: "bi.icon_text_icon_node", - value: "AAA" + value: "AAA", }); expect(iconTextIconNode.getValue()).to.equal("AAA"); iconTextIconNode.destroy(); @@ -91,7 +90,7 @@ describe("IconTextIconNodeTest", function () { text: "AAA", handler: function () { this.setText("click"); - } + }, }); BI.nextTick(function () { iconTextIconNode.element.click(); @@ -100,5 +99,4 @@ describe("IconTextIconNodeTest", function () { done(); }); }); - }); diff --git a/src/base/single/button/node/__test__/icontextnode.test.js b/src/base/single/button/node/__test__/icontextnode.test.js index 2319e23e2..25b6ebc9f 100644 --- a/src/base/single/button/node/__test__/icontextnode.test.js +++ b/src/base/single/button/node/__test__/icontextnode.test.js @@ -4,13 +4,12 @@ */ describe("IconTextNodeTest", function () { - /** * test_author_kobi */ it("setText", function () { var iconTextNode = BI.Test.createWidget({ - type: "bi.icon_text_node" + type: "bi.icon_text_node", }); iconTextNode.setText("AAA"); expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA"); @@ -34,7 +33,7 @@ describe("IconTextNodeTest", function () { */ it("setValue", function () { var iconTextNode = BI.Test.createWidget({ - type: "bi.icon_text_node" + type: "bi.icon_text_node", }); iconTextNode.setValue("AAA"); expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA"); @@ -48,7 +47,7 @@ describe("IconTextNodeTest", function () { var iconTextNode = BI.Test.createWidget({ type: "bi.icon_text_node", value: "AAA", - readonly: true + readonly: true, }); iconTextNode.setValue("BBB"); expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA"); @@ -61,7 +60,7 @@ describe("IconTextNodeTest", function () { it("getValue", function () { var iconTextNode = BI.Test.createWidget({ type: "bi.icon_text_node", - value: "AAA" + value: "AAA", }); expect(iconTextNode.getValue()).to.equal("AAA"); iconTextNode.destroy(); @@ -91,7 +90,7 @@ describe("IconTextNodeTest", function () { text: "AAA", handler: function () { this.setText("click"); - } + }, }); BI.nextTick(function () { iconTextNode.element.click(); @@ -100,5 +99,4 @@ describe("IconTextNodeTest", function () { done(); }); }); - }); diff --git a/src/base/single/button/node/__test__/texticonnode.test.js b/src/base/single/button/node/__test__/texticonnode.test.js index 9eb4ec2db..1523f8ce6 100644 --- a/src/base/single/button/node/__test__/texticonnode.test.js +++ b/src/base/single/button/node/__test__/texticonnode.test.js @@ -4,13 +4,12 @@ */ describe("TextIconNodeTest", function () { - /** * test_author_kobi */ it("setText", function () { var textIconNode = BI.Test.createWidget({ - type: "bi.text_icon_node" + type: "bi.text_icon_node", }); textIconNode.setText("AAA"); expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA"); @@ -34,7 +33,7 @@ describe("TextIconNodeTest", function () { */ it("setValue", function () { var textIconNode = BI.Test.createWidget({ - type: "bi.text_icon_node" + type: "bi.text_icon_node", }); textIconNode.setValue("AAA"); expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA"); @@ -48,7 +47,7 @@ describe("TextIconNodeTest", function () { var textIconNode = BI.Test.createWidget({ type: "bi.text_icon_node", value: "AAA", - readonly: true + readonly: true, }); textIconNode.setValue("BBB"); expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA"); @@ -61,7 +60,7 @@ describe("TextIconNodeTest", function () { it("getValue", function () { var textIconNode = BI.Test.createWidget({ type: "bi.text_icon_node", - value: "AAA" + value: "AAA", }); expect(textIconNode.getValue()).to.equal("AAA"); textIconNode.destroy(); @@ -91,7 +90,7 @@ describe("TextIconNodeTest", function () { text: "AAA", handler: function () { this.setText("click"); - } + }, }); BI.nextTick(function () { textIconNode.element.click(); @@ -100,5 +99,4 @@ describe("TextIconNodeTest", function () { done(); }); }); - }); diff --git a/src/base/single/button/node/__test__/textnode.test.js b/src/base/single/button/node/__test__/textnode.test.js index 5674ae263..7b78bbb6b 100644 --- a/src/base/single/button/node/__test__/textnode.test.js +++ b/src/base/single/button/node/__test__/textnode.test.js @@ -4,13 +4,12 @@ */ describe("TextNodeTest", function () { - /** * test_author_kobi */ it("setText", function () { var textNode = BI.Test.createWidget({ - type: "bi.text_node" + type: "bi.text_node", }); textNode.setText("AAA"); expect(textNode.element.children(".bi-text").text()).to.equal("AAA"); @@ -24,7 +23,7 @@ describe("TextNodeTest", function () { var textNode = BI.Test.createWidget({ type: "bi.text_node", text: "AAA", - whiteSpace: "normal" + whiteSpace: "normal", }); expect(textNode.getText()).to.equal("AAA"); textNode.destroy(); @@ -35,7 +34,7 @@ describe("TextNodeTest", function () { */ it("setValue", function () { var textNode = BI.Test.createWidget({ - type: "bi.text_node" + type: "bi.text_node", }); textNode.setValue("AAA"); expect(textNode.element.children(".bi-text").text()).to.equal("AAA"); @@ -49,7 +48,7 @@ describe("TextNodeTest", function () { var textNode = BI.Test.createWidget({ type: "bi.text_node", value: "AAA", - readonly: true + readonly: true, }); textNode.setValue("BBB"); expect(textNode.element.children(".bi-text").text()).to.equal("AAA"); @@ -62,7 +61,7 @@ describe("TextNodeTest", function () { it("getValue", function () { var textNode = BI.Test.createWidget({ type: "bi.text_node", - value: "AAA" + value: "AAA", }); expect(textNode.getValue()).to.equal("AAA"); textNode.destroy(); @@ -92,7 +91,7 @@ describe("TextNodeTest", function () { text: "AAA", handler: function () { this.setText("click"); - } + }, }); BI.nextTick(function () { textNode.element.click(); @@ -101,6 +100,4 @@ describe("TextNodeTest", function () { done(); }); }); - - }); diff --git a/src/base/single/button/node/icontexticonnode.js b/src/base/single/button/node/icontexticonnode.js index 13d967425..7569490eb 100644 --- a/src/base/single/button/node/icontexticonnode.js +++ b/src/base/single/button/node/icontexticonnode.js @@ -8,6 +8,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, { _defaultConfig: function () { var conf = BI.IconTextIconNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-icon-text-icon-node", iconCls1: "close-ha-font", @@ -17,7 +18,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -33,7 +34,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, { width: o.leftIconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight + iconHeight: o.iconHeight, }, { el: { type: "bi.label", @@ -48,16 +49,16 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, { text: o.text, value: o.value, keyword: o.keyword, - height: o.height - } + height: o.height, + }, }, { type: "bi.icon_label", cls: o.iconCls2, width: o.rightIconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight - }] + iconHeight: o.iconHeight, + }], }; }, @@ -92,7 +93,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, { getText: function () { return this.text.getText(); - } + }, }); BI.IconTextIconNode.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.icon_text_icon_node", BI.IconTextIconNode); diff --git a/src/base/single/button/node/icontextnode.js b/src/base/single/button/node/icontextnode.js index 5c9f1a4ca..16383cc7d 100644 --- a/src/base/single/button/node/icontextnode.js +++ b/src/base/single/button/node/icontextnode.js @@ -8,6 +8,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, { _defaultConfig: function () { var conf = BI.IconTextNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-icon-text-node", cls: "close-ha-font", @@ -16,7 +17,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -32,7 +33,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, { width: o.iconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight + iconHeight: o.iconHeight, }, { el: { type: "bi.label", @@ -48,9 +49,9 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, { text: o.text, value: o.value, keyword: o.keyword, - height: o.height - } - }] + height: o.height, + }, + }], }; }, @@ -85,7 +86,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, { unRedMark: function () { this.text.unRedMark.apply(this.text, arguments); - } + }, }); BI.IconTextNode.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.icon_text_node", BI.IconTextNode); diff --git a/src/base/single/button/node/texticonnode.js b/src/base/single/button/node/texticonnode.js index 6671c19a1..01167b009 100644 --- a/src/base/single/button/node/texticonnode.js +++ b/src/base/single/button/node/texticonnode.js @@ -7,6 +7,7 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, { _defaultConfig: function () { var conf = BI.TextIconNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-icon-node", cls: "close-ha-font", @@ -15,7 +16,7 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -40,16 +41,16 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, { text: o.text, value: o.value, keyword: o.keyword, - height: o.height - } + height: o.height, + }, }, { type: "bi.icon_label", cls: o.iconCls, width: o.iconWrapperWidth || o.height, height: o.height, iconWidth: o.iconWidth, - iconHeight: o.iconHeight - }] + iconHeight: o.iconHeight, + }], }; }, @@ -84,7 +85,7 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, { unRedMark: function () { this.text.unRedMark.apply(this.text, arguments); - } + }, }); BI.TextIconNode.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.text_icon_node", BI.TextIconNode); diff --git a/src/base/single/button/node/textnode.js b/src/base/single/button/node/textnode.js index 74974456c..6ecaa3fbf 100644 --- a/src/base/single/button/node/textnode.js +++ b/src/base/single/button/node/textnode.js @@ -9,6 +9,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, { _defaultConfig: function () { var conf = BI.TextNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-node", textAlign: "left", @@ -16,7 +17,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, { textHgap: 0, textVgap: 0, textLgap: 0, - textRgap: 0 + textRgap: 0, }); }, @@ -27,7 +28,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, { element: this, textAlign: o.textAlign, whiteSpace: o.whiteSpace, - textHeight: o.whiteSpace == "nowrap" ? o.height : o.textHeight, + textHeight: o.whiteSpace === "nowrap" ? o.height : o.textHeight, height: o.height, hgap: o.textHgap, vgap: o.textVgap, @@ -36,7 +37,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, { text: o.text, value: o.value, keyword: o.keyword, - py: o.py + py: o.py, }); }, @@ -71,7 +72,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, { getText: function () { return this.text.getText(); - } + }, }); BI.TextNode.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.text_node", BI.TextNode); diff --git a/src/base/single/editor/editor.js b/src/base/single/editor/editor.js index 5322124d9..ac9e779e9 100644 --- a/src/base/single/editor/editor.js +++ b/src/base/single/editor/editor.js @@ -38,7 +38,7 @@ BI.Editor = BI.inherit(BI.Single, { watermark: o.watermark, validationChecker: o.validationChecker, quitChecker: o.quitChecker, - allowBlank: o.allowBlank + allowBlank: o.allowBlank, })); this.editor.element.css({ width: "100%", @@ -46,7 +46,7 @@ BI.Editor = BI.inherit(BI.Single, { border: "none", outline: "none", padding: "0", - margin: "0" + margin: "0", }); var items = [{ @@ -60,19 +60,19 @@ BI.Editor = BI.inherit(BI.Single, { left: 0, right: 0, top: 0, - bottom: 0 - }] + bottom: 0, + }], }, left: o.hgap + o.lgap, right: o.hgap + o.rgap, top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap + bottom: o.vgap + o.bgap, }]; BI.createWidget({ type: "bi.absolute", element: this, - items: items + items: items, }); this.setWaterMark(this.options.watermark); @@ -159,6 +159,7 @@ BI.Editor = BI.inherit(BI.Single, { }); this.element.click(function (e) { e.stopPropagation(); + return false; }); if (BI.isKey(this.options.value) || BI.isEmptyString(this.options.value)) { @@ -194,7 +195,7 @@ BI.Editor = BI.inherit(BI.Single, { height: o.height - 2 * o.vgap - o.tgap, hgap: 2, whiteSpace: "nowrap", - textAlign: "left" + textAlign: "left", }); this.watermark.element.bind({ mousedown: function (e) { @@ -204,7 +205,7 @@ BI.Editor = BI.inherit(BI.Single, { self.editor.isEditing() && self.editor.blur(); } e.stopEvent(); - } + }, }); this.watermark.element.bind("click", function (e) { if (self.isEnabled()) { @@ -240,7 +241,6 @@ BI.Editor = BI.inherit(BI.Single, { }, setWaterMark: function (v) { - this.options.watermark = v; if (BI.isNull(this.watermark)) { @@ -269,7 +269,7 @@ BI.Editor = BI.inherit(BI.Single, { } if (!this.disabledError && BI.isKey(errorText)) { BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this, { - adjustYOffset: o.simple ? 1 : 2 + adjustYOffset: o.simple ? 1 : 2, }); this._checkToolTip(); } @@ -332,6 +332,7 @@ BI.Editor = BI.inherit(BI.Single, { if (!this.isValid()) { return BI.trim(this.editor.getLastValidValue()); } + return BI.trim(this.editor.getValue()); }, @@ -345,7 +346,7 @@ BI.Editor = BI.inherit(BI.Single, { destroyed: function () { BI.Bubbles.remove(this.getName()); - } + }, }); BI.Editor.EVENT_CHANGE = "EVENT_CHANGE"; BI.Editor.EVENT_FOCUS = "EVENT_FOCUS"; diff --git a/src/base/single/editor/editor.multifile.js b/src/base/single/editor/editor.multifile.js index ae0d5e0a9..21765474d 100644 --- a/src/base/single/editor/editor.multifile.js +++ b/src/base/single/editor/editor.multifile.js @@ -9,12 +9,13 @@ BI.MultifileEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { var conf = BI.MultifileEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-multifile-editor", multiple: false, maxSize: -1, // 1024 * 1024 accept: "", - url: "" + url: "", }); }, @@ -57,13 +58,13 @@ BI.MultifileEditor = BI.inherit(BI.Widget, { el: { type: "bi.adaptive", scrollable: false, - items: [this.file] + items: [this.file], }, top: 0, right: 0, left: 0, - bottom: 0 - }] + bottom: 0, + }], }); }, @@ -104,7 +105,7 @@ BI.MultifileEditor = BI.inherit(BI.Widget, { reset: function () { this._reset(); - } + }, }); BI.MultifileEditor.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultifileEditor.EVENT_UPLOADSTART = "EVENT_UPLOADSTART"; diff --git a/src/base/single/html/__test__/html.test.js b/src/base/single/html/__test__/html.test.js index 2d599ecd7..1414b1e59 100644 --- a/src/base/single/html/__test__/html.test.js +++ b/src/base/single/html/__test__/html.test.js @@ -5,14 +5,13 @@ */ describe("HtmlTest", function () { - /** * test_author_windy */ it("html_h1", function () { var a = BI.Test.createWidget({ type: "bi.html", - text: "