Browse Source

BI-61182 test: 单测62.21%

es6
windy 5 years ago
parent
commit
7ab2fd1595
  1. 3
      karma.conf.js
  2. 240
      src/case/button/treeitem/__test__/item.treeleaf.test.js
  3. 21
      src/case/button/treeitem/item.first.treeleaf.js
  4. 8
      src/case/button/treeitem/item.icon.treeleaf.js
  5. 21
      src/case/button/treeitem/item.last.treeleaf.js
  6. 21
      src/case/button/treeitem/item.mid.treeleaf.js

3
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",
],

240
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();
});
});

21
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);
}
});

8
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);
}
});

21
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);
}
});

21
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);
}
});

Loading…
Cancel
Save