diff --git a/karma.conf.js b/karma.conf.js index cdeb3baad8..24138a4eb5 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -64,7 +64,8 @@ module.exports = function (config) { exclude: [ "src/base/tree/ztree/jquery.ztree.core-3.5.js", - "src/base/tree/ztree/jquery.ztree.excheck-3.5.js" + "src/base/tree/ztree/jquery.ztree.excheck-3.5.js", + "src/base/single/input/file.js", ], diff --git a/src/case/button/treeitem/__test__/item.treeleaf.test.js b/src/case/button/treeitem/__test__/item.treeleaf.test.js new file mode 100644 index 0000000000..57b2e66f94 --- /dev/null +++ b/src/case/button/treeitem/__test__/item.treeleaf.test.js @@ -0,0 +1,240 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2020/5/8 + */ +describe("leafTest", function () { + + /** + * test_author_windy + */ + it("标红与高亮", function () { + var textNode = BI.Test.createWidget({ + type: "bi.first_tree_leaf_item", + id: "1", + pId: "-1", + layer: 0, + height: 24, + text: "ABC", + keyword: "B" + }); + textNode.doRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + textNode.unRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0); + textNode.doHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.not.equal(0); + textNode.unHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.equal(0); + textNode.destroy(); + }); + + /** + * test_author_windy + */ + it("function", function () { + var textNode = BI.Test.createWidget({ + type: "bi.first_tree_leaf_item", + id: "1", + pId: "-1" + }); + expect(textNode.getId()).to.equal("1"); + expect(textNode.getPId()).to.equal("-1"); + textNode.destroy(); + }); + + + /** + * test_author_windy + */ + it("标红与高亮1", function () { + var textNode = BI.Test.createWidget({ + type: "bi.last_tree_leaf_item", + id: "1", + pId: "-1", + layer: 0, + height: 24, + text: "ABC", + keyword: "B" + }); + textNode.doRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + textNode.unRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0); + textNode.doHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.not.equal(0); + textNode.unHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.equal(0); + textNode.destroy(); + }); + + /** + * test_author_windy + */ + it("function1", function () { + var textNode = BI.Test.createWidget({ + type: "bi.last_tree_leaf_item", + id: "1", + pId: "-1" + }); + expect(textNode.getId()).to.equal("1"); + expect(textNode.getPId()).to.equal("-1"); + textNode.destroy(); + }); + + + /** + * test_author_windy + */ + it("标红与高亮12", function () { + var textNode = BI.Test.createWidget({ + type: "bi.mid_tree_leaf_item", + id: "1", + pId: "-1", + layer: 0, + height: 24, + text: "ABC", + keyword: "B" + }); + textNode.doRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + textNode.unRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0); + textNode.doHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.not.equal(0); + textNode.unHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.equal(0); + textNode.destroy(); + }); + + /** + * test_author_windy + */ + it("function12", function () { + var textNode = BI.Test.createWidget({ + type: "bi.mid_tree_leaf_item", + id: "1", + pId: "-1" + }); + expect(textNode.getId()).to.equal("1"); + expect(textNode.getPId()).to.equal("-1"); + textNode.destroy(); + }); + + /** + * test_author_windy + */ + it("标红与高亮123", function () { + var textNode = BI.Test.createWidget({ + type: "bi.icon_tree_leaf_item", + id: "1", + pId: "-1", + layer: 0, + height: 24, + text: "ABC", + keyword: "B" + }); + textNode.doRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + textNode.unRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0); + textNode.doHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.not.equal(0); + textNode.unHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.equal(0); + textNode.destroy(); + }); + + /** + * test_author_windy + */ + it("function123", function () { + var textNode = BI.Test.createWidget({ + type: "bi.icon_tree_leaf_item", + id: "1", + pId: "-1" + }); + expect(textNode.getId()).to.equal("1"); + expect(textNode.getPId()).to.equal("-1"); + textNode.destroy(); + }); + + + /** + * test_author_windy + */ + it("标红与高亮1234", function () { + var textNode = BI.Test.createWidget({ + type: "bi.multilayer_icon_tree_leaf_item", + id: "1", + pId: "-1", + layer: 0, + height: 24, + text: "ABC", + keyword: "B" + }); + textNode.doRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + textNode.unRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0); + textNode.doHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.not.equal(0); + textNode.unHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.equal(0); + textNode.destroy(); + }); + + /** + * test_author_windy + */ + it("function1234", function () { + var textNode = BI.Test.createWidget({ + type: "bi.multilayer_icon_tree_leaf_item", + id: "1", + pId: "-1" + }); + expect(textNode.getId()).to.equal("1"); + expect(textNode.getPId()).to.equal("-1"); + textNode.destroy(); + }); + + + /** + * test_author_windy + */ + it("标红与高亮12345", function () { + var textNode = BI.Test.createWidget({ + type: "bi.tree_text_leaf_item", + id: "1", + pId: "-1", + layer: 0, + height: 24, + text: "ABC", + keyword: "B" + }); + textNode.doRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0); + textNode.unRedMark("C"); + expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0); + textNode.doHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.not.equal(0); + textNode.unHighLight("C"); + expect(textNode.element.find(".bi-high-light").length).to.equal(0); + textNode.destroy(); + }); + + /** + * test_author_windy + */ + it("function12345", function () { + var textNode = BI.Test.createWidget({ + type: "bi.tree_text_leaf_item", + id: "1", + pId: "-1" + }); + expect(textNode.getId()).to.equal("1"); + expect(textNode.getPId()).to.equal("-1"); + textNode.destroy(); + }); + +}); \ No newline at end of file diff --git a/src/case/button/treeitem/item.first.treeleaf.js b/src/case/button/treeitem/item.first.treeleaf.js index 4615486085..afaa2f6fc7 100644 --- a/src/case/button/treeitem/item.first.treeleaf.js +++ b/src/case/button/treeitem/item.first.treeleaf.js @@ -13,10 +13,7 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, { }, _init: function () { BI.FirstTreeLeafItem.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.checkbox = BI.createWidget({ - type: "bi.checkbox" - }); + var o = this.options; this.text = BI.createWidget({ type: "bi.label", textAlign: "left", @@ -29,12 +26,6 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, { py: o.py, keyword: o.keyword }); - this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) { - self.setSelected(self.isSelected()); - } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : { width: 12, @@ -84,16 +75,6 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, { getPId: function () { return this.options.pId; - }, - - doClick: function () { - BI.FirstTreeLeafItem.superclass.doClick.apply(this, arguments); - this.checkbox.setSelected(this.isSelected()); - }, - - setSelected: function (v) { - BI.FirstTreeLeafItem.superclass.setSelected.apply(this, arguments); - this.checkbox.setSelected(v); } }); diff --git a/src/case/button/treeitem/item.icon.treeleaf.js b/src/case/button/treeitem/item.icon.treeleaf.js index 403ab03d44..f1623d47a1 100644 --- a/src/case/button/treeitem/item.icon.treeleaf.js +++ b/src/case/button/treeitem/item.icon.treeleaf.js @@ -75,14 +75,6 @@ BI.IconTreeLeafItem = BI.inherit(BI.BasicButton, { getPId: function () { return this.options.pId; - }, - - doClick: function () { - BI.IconTreeLeafItem.superclass.doClick.apply(this, arguments); - }, - - setSelected: function (v) { - BI.IconTreeLeafItem.superclass.setSelected.apply(this, arguments); } }); diff --git a/src/case/button/treeitem/item.last.treeleaf.js b/src/case/button/treeitem/item.last.treeleaf.js index 135124db66..8b30892a37 100644 --- a/src/case/button/treeitem/item.last.treeleaf.js +++ b/src/case/button/treeitem/item.last.treeleaf.js @@ -13,10 +13,7 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, { }, _init: function () { BI.LastTreeLeafItem.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.checkbox = BI.createWidget({ - type: "bi.checkbox" - }); + var o = this.options; this.text = BI.createWidget({ type: "bi.label", textAlign: "left", @@ -29,12 +26,6 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, { py: o.py, keyword: o.keyword }); - this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) { - self.setSelected(self.isSelected()); - } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : { width: 12, @@ -84,16 +75,6 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, { getPId: function () { return this.options.pId; - }, - - doClick: function () { - BI.LastTreeLeafItem.superclass.doClick.apply(this, arguments); - // this.checkbox.setSelected(this.isSelected()); - }, - - setSelected: function (v) { - BI.LastTreeLeafItem.superclass.setSelected.apply(this, arguments); - // this.checkbox.setSelected(v); } }); diff --git a/src/case/button/treeitem/item.mid.treeleaf.js b/src/case/button/treeitem/item.mid.treeleaf.js index 77a4126e82..a3a7a6c93c 100644 --- a/src/case/button/treeitem/item.mid.treeleaf.js +++ b/src/case/button/treeitem/item.mid.treeleaf.js @@ -13,10 +13,7 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, { }, _init: function () { BI.MidTreeLeafItem.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.checkbox = BI.createWidget({ - type: "bi.checkbox" - }); + var o = this.options; this.text = BI.createWidget({ type: "bi.label", textAlign: "left", @@ -29,12 +26,6 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, { py: o.py, keyword: o.keyword }); - this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) { - self.setSelected(self.isSelected()); - } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : { width: 12, @@ -84,16 +75,6 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, { getPId: function () { return this.options.pId; - }, - - doClick: function () { - BI.MidTreeLeafItem.superclass.doClick.apply(this, arguments); - this.checkbox.setSelected(this.isSelected()); - }, - - setSelected: function (v) { - BI.MidTreeLeafItem.superclass.setSelected.apply(this, arguments); - this.checkbox.setSelected(v); } });