diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 8a5901bf1..07fd48d7e 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -61581,8 +61581,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -61722,8 +61723,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -83291,7 +83293,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { border: 1 }, props: { - baseCls: "bi-time-combo bi-border bi-border-radius", + baseCls: "bi-time-combo bi-border bi-border-radius bi-focus-shadow", width: 78, height: 22, format: "", diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index db2861f63..960ee134f 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -61985,8 +61985,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -62126,8 +62127,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -83695,7 +83697,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { border: 1 }, props: { - baseCls: "bi-time-combo bi-border bi-border-radius", + baseCls: "bi-time-combo bi-border bi-border-radius bi-focus-shadow", width: 78, height: 22, format: "", diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 8a5901bf1..07fd48d7e 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -61581,8 +61581,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -61722,8 +61723,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -83291,7 +83293,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { border: 1 }, props: { - baseCls: "bi-time-combo bi-border bi-border-radius", + baseCls: "bi-time-combo bi-border bi-border-radius bi-focus-shadow", width: 78, height: 22, format: "", diff --git a/dist/bundle.js b/dist/bundle.js index db2861f63..960ee134f 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -61985,8 +61985,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -62126,8 +62127,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -83695,7 +83697,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { border: 1 }, props: { - baseCls: "bi-time-combo bi-border bi-border-radius", + baseCls: "bi-time-combo bi-border bi-border-radius bi-focus-shadow", width: 78, height: 22, format: "", diff --git a/dist/case.js b/dist/case.js index 11e603be1..6b9082132 100644 --- a/dist/case.js +++ b/dist/case.js @@ -9561,8 +9561,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -9702,8 +9703,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 62806340e..167a887db 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -61826,8 +61826,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -61967,8 +61968,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -83536,7 +83538,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { border: 1 }, props: { - baseCls: "bi-time-combo bi-border bi-border-radius", + baseCls: "bi-time-combo bi-border bi-border-radius bi-focus-shadow", width: 78, height: 22, format: "", diff --git a/dist/fineui.js b/dist/fineui.js index d2acd37aa..c89e58137 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -62230,8 +62230,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -62371,8 +62372,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -83940,7 +83942,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { border: 1 }, props: { - baseCls: "bi-time-combo bi-border bi-border-radius", + baseCls: "bi-time-combo bi-border bi-border-radius bi-focus-shadow", width: 78, height: 22, format: "", diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 26fc584b3..95ab52918 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -28559,6 +28559,36 @@ BI.ButtonTree.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.button_tree", BI.ButtonTree);/** * Created by windy on 2018/01/23. */ +describe("ALinkTest", function () { + + /** + * test_author_windy + */ + it("A初始化测试", function () { + var a = BI.Test.createWidget({ + type: "bi.a", + text: "CCC" + }); + expect(a.element.is('a')).to.equal(true); + }); + + /** + * test_author_windy + */ + it("A的el测试", function () { + var a = BI.Test.createWidget({ + type: "bi.a", + text: "DDD", + el: { + type: "bi.label" + } + }); + expect(a.element.is('a') && a.element.hasClass("bi-label")).to.equal(true); + }); +}); +/** + * Created by windy on 2018/01/23. + */ describe("ButtonTest", function () { /** @@ -28763,11 +28793,10 @@ describe("TextTest", function () { it("setValue", function () { var text = BI.Test.createWidget({ type: "bi.text", - text: "我是要标红的A", - keyword: "A" + value: "AAA", }); - text.unRedMark(); - expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); + text.setValue("value"); + expect(text.element.text()).to.equal("value"); text.destroy(); }); @@ -28778,10 +28807,10 @@ describe("TextTest", function () { var text = BI.Test.createWidget({ type: "bi.text", text: "我是要标红的A", - keyword: "A" + vgap: 10, + hgap: 10 }); - text.unRedMark(); - expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); + expect(text.element.css("padding")).to.equal("10px"); text.destroy(); }); @@ -28792,12 +28821,44 @@ describe("TextTest", function () { var text = BI.Test.createWidget({ type: "bi.text", text: "我是要标红的 A", - keyword: "A" }); - text.unRedMark(); - expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); + expect(text.element.text()).to.equal("我是要标红的 A"); + text.destroy(); + }); + + /** + * test_author_windy + */ + it("lineHeight和height", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "我是A", + lineHeight: 12, + height: 24 + }); + expect(text.element.css("height")).to.equal("24px"); + expect(text.element.css("line-height")).to.equal("12px"); text.destroy(); }); + + /** + * test_author_windy + */ + it("handler", function (done) { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "我是A", + handler: function () { + text.setText("handler"); + } + }); + BI.nextTick(function () { + text.text.element.click(); + expect(text.text.element.text()).to.equal("handler"); + text.destroy(); + done(); + }); + }); }); BI.prepares.push(function () { BI.Resizers = new BI.ResizeController(); @@ -44775,8 +44836,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -44916,8 +44978,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { setTextCls: function(cls) { var o = this.options; - this.text.element.removeClass(o.textCls).addClass(cls); + var oldCls = o.textCls; o.textCls = cls; + this.text.element.removeClass(oldCls).addClass(cls); }, setText: function (text) { @@ -66485,7 +66548,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { border: 1 }, props: { - baseCls: "bi-time-combo bi-border bi-border-radius", + baseCls: "bi-time-combo bi-border bi-border-radius bi-focus-shadow", width: 78, height: 22, format: "", diff --git a/dist/widget.js b/dist/widget.js index 78b6a7400..1d68f7b22 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -21363,7 +21363,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { border: 1 }, props: { - baseCls: "bi-time-combo bi-border bi-border-radius", + baseCls: "bi-time-combo bi-border bi-border-radius bi-focus-shadow", width: 78, height: 22, format: "", diff --git a/karma.conf.js b/karma.conf.js index 8c1c2e24d..ae5a5a85f 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -17,6 +17,7 @@ module.exports = function (config) { "src/css/core/**/*.css", "src/css/theme/**/*.css", "src/css/base/**/*.css", + "src/css/widget/**/*.css", "src/core/foundation.js", "src/core/lodash.js", "src/core/base.js", @@ -47,6 +48,9 @@ module.exports = function (config) { "src/base/tree/ztree/list/listasynctree.js", "src/base/tree/ztree/list/listparttree.js", "src/base/**/*.js", + "src/case/**/*.js", + "src/widget/**/*.js", + "src/component/**/*.js", "src/**/*.test.js", "test/**/*.js" ], @@ -58,7 +62,10 @@ module.exports = function (config) { "src/core/alias.js": "coverage", "src/core/base.js": "coverage", "src/core/func/date.js": "coverage", - "src/base/**/!(*.test).js": "coverage" + "src/base/**/!(*.test).js": "coverage", + "src/case/**/!(*.test).js": "coverage", + "src/widget/**/!(*.test).js": "coverage", + "src/component/**/!(*.test).js": "coverage" }, diff --git a/src/base/__test__/a.test.js b/src/base/__test__/a.test.js new file mode 100644 index 000000000..9e5b508ad --- /dev/null +++ b/src/base/__test__/a.test.js @@ -0,0 +1,30 @@ +/** + * Created by windy on 2018/01/23. + */ +describe("ALinkTest", function () { + + /** + * test_author_windy + */ + it("A初始化测试", function () { + var a = BI.Test.createWidget({ + type: "bi.a", + text: "CCC" + }); + expect(a.element.is('a')).to.equal(true); + }); + + /** + * test_author_windy + */ + it("A的el测试", function () { + var a = BI.Test.createWidget({ + type: "bi.a", + text: "DDD", + el: { + type: "bi.label" + } + }); + expect(a.element.is('a') && a.element.hasClass("bi-label")).to.equal(true); + }); +}); diff --git a/src/base/__test__/text.test.js b/src/base/__test__/text.test.js index 332caa8ab..a2a774d2a 100644 --- a/src/base/__test__/text.test.js +++ b/src/base/__test__/text.test.js @@ -81,4 +81,77 @@ describe("TextTest", function () { expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); text.destroy(); }); + + /** + * test_author_windy + */ + it("setValue", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + value: "AAA", + }); + text.setValue("value"); + expect(text.element.text()).to.equal("value"); + text.destroy(); + }); + + /** + * test_author_windy + */ + it("gap测试", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "我是要标红的A", + vgap: 10, + hgap: 10 + }); + expect(text.element.css("padding")).to.equal("10px"); + text.destroy(); + }); + + /** + * test_author_windy + */ + it("空格测试", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "我是要标红的 A", + }); + expect(text.element.text()).to.equal("我是要标红的 A"); + text.destroy(); + }); + + /** + * test_author_windy + */ + it("lineHeight和height", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "我是A", + lineHeight: 12, + height: 24 + }); + expect(text.element.css("height")).to.equal("24px"); + expect(text.element.css("line-height")).to.equal("12px"); + text.destroy(); + }); + + /** + * test_author_windy + */ + it("handler", function (done) { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "我是A", + handler: function () { + text.setText("handler"); + } + }); + BI.nextTick(function () { + text.text.element.click(); + expect(text.text.element.text()).to.equal("handler"); + text.destroy(); + done(); + }); + }); }); diff --git a/src/widget/time/time.combo.js b/src/widget/time/time.combo.js index 3f5e5d497..e9f0f0393 100644 --- a/src/widget/time/time.combo.js +++ b/src/widget/time/time.combo.js @@ -13,7 +13,7 @@ border: 1 }, props: { - baseCls: "bi-time-combo bi-border bi-border-radius", + baseCls: "bi-time-combo bi-border bi-border-radius bi-focus-shadow", width: 78, height: 22, format: "",