Browse Source

BI-61182 test: 单测up to 67.15%

es6
windy 4 years ago
parent
commit
f8621fb2bd
  1. 6
      karma.conf.js
  2. 92
      src/case/editor/__test__/editor.clear.test.js
  3. 70
      src/case/editor/__test__/editor.sign.test.js
  4. 70
      src/case/editor/__test__/editor.state.simple.test.js
  5. 70
      src/case/editor/__test__/editor.state.test.js
  6. 180
      src/component/treevaluechooser/__test__/combo.listtreevaluechooser.test.js
  7. 252
      src/component/treevaluechooser/__test__/combo.treevaluechooser.insert.test.js
  8. 252
      src/component/treevaluechooser/__test__/combo.treevaluechooser.test.js
  9. 268
      src/component/treevaluechooser/__test__/pane.treevaluechooser.test.js
  10. 6
      src/widget/editor/__test__/editor.search.test.js

6
karma.conf.js

@ -66,6 +66,12 @@ module.exports = function (config) {
"src/base/tree/ztree/jquery.ztree.core-3.5.js", "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", "src/base/single/input/file.js",
"src/case/loading/loading_pane.js",
"src/base/tree/ztree/**/*.js",
"src/case/tree/ztree/*.js",
"src/widget/multitree/**/*.js",
"src/widget/multiselecttree/**/*.js",
"src/component/treevaluechooser/*.js"
], ],

92
src/case/editor/__test__/editor.clear.test.js

@ -0,0 +1,92 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/5/13
*/
describe("clear_editor", function () {
/**
* test_author_windy
*/
it("clear-editor", function (done) {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
value: "12345",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setWaterMark("AAAAA");
expect(editor.element.find(".bi-water-mark").text()).to.equal("AAAAA");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
});
/**
* test_author_windy
*/
it("clear", function (done) {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
value: "12345",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
BI.nextTick(function () {
editor.element.find(".search-close-h-font").click();
expect(editor.element.find(".bi-input").val()).to.equal("");
editor.destroy();
done();
});
});
/**
* test_author_windy
*/
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
/**
* test_author_windy
*/
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
value: "12346",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
});

70
src/case/editor/__test__/editor.sign.test.js

@ -0,0 +1,70 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/5/13
*/
describe("sign_editor", function () {
/**
* test_author_windy
*/
it("sign-editor", function (done) {
var editor = BI.Test.createWidget({
type: "bi.sign_editor",
width: 300,
value: "12345",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setWaterMark("AAAAA");
expect(editor.element.find(".bi-water-mark").text()).to.equal("AAAAA");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
});
/**
* test_author_windy
*/
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.sign_editor",
width: 300,
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
/**
* test_author_windy
*/
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.sign_editor",
width: 300,
value: "12346",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
});

70
src/case/editor/__test__/editor.state.simple.test.js

@ -0,0 +1,70 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/5/13
*/
describe("simple_state_editor", function () {
/**
* test_author_windy
*/
it("state-editor", function (done) {
var editor = BI.Test.createWidget({
type: "bi.simple_state_editor",
width: 300,
value: "12345",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setWaterMark("AAAAA");
expect(editor.element.find(".bi-water-mark").text()).to.equal("AAAAA");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
});
/**
* test_author_windy
*/
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.simple_state_editor",
width: 300,
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
/**
* test_author_windy
*/
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.simple_state_editor",
width: 300,
value: "12346",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
});

70
src/case/editor/__test__/editor.state.test.js

@ -0,0 +1,70 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/5/13
*/
describe("state_editor", function () {
/**
* test_author_windy
*/
it("state-editor", function (done) {
var editor = BI.Test.createWidget({
type: "bi.state_editor",
width: 300,
value: "12345",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setWaterMark("AAAAA");
expect(editor.element.find(".bi-water-mark").text()).to.equal("AAAAA");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
});
/**
* test_author_windy
*/
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.state_editor",
width: 300,
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
/**
* test_author_windy
*/
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.state_editor",
width: 300,
value: "12346",
watermark: "添加合法性判断",
errorText: "长度必须大于4",
validationChecker: function () {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
});

180
src/component/treevaluechooser/__test__/combo.listtreevaluechooser.test.js

@ -3,93 +3,93 @@
* @version 2.0 * @version 2.0
* Created by windy on 2019/9/25 * Created by windy on 2019/9/25
*/ */
describe("list_tree_value_chooser_insert_combo", function () { // describe("list_tree_value_chooser_insert_combo", function () {
//
var items = [{pId: "0", id: "0_0", text: "中国", value: "", open: true}, { // var items = [{pId: "0", id: "0_0", text: "中国", value: "", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_0", // id: "0_0_0",
text: "安徽省( 共1个 )", // text: "安徽省( 共1个 )",
value: "安徽省", // value: "安徽省",
open: true // open: true
}, {pId: "0_0_0", id: "0_0_0_0", text: "芜湖市", value: "芜湖市", open: true}, { // }, {pId: "0_0_0", id: "0_0_0_0", text: "芜湖市", value: "芜湖市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_1", // id: "0_0_1",
text: "北京市( 共6个 )", // text: "北京市( 共6个 )",
value: "北京市", // value: "北京市",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_0", text: "北京市区", value: "北京市区", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_0", text: "北京市区", value: "北京市区", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_1", // id: "0_0_1_1",
text: "朝阳区", // text: "朝阳区",
value: "朝阳区", // value: "朝阳区",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_2", text: "东城区", value: "东城区", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_2", text: "东城区", value: "东城区", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_3", // id: "0_0_1_3",
text: "海淀区4内", // text: "海淀区4内",
value: "海淀区4内", // value: "海淀区4内",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_4", text: "海淀区4外", value: "海淀区4外", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_4", text: "海淀区4外", value: "海淀区4外", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_5", // id: "0_0_1_5",
text: "石景山区", // text: "石景山区",
value: "石景山区", // value: "石景山区",
open: true // open: true
}, {pId: "0_0", id: "0_0_2", text: "福建省( 共2个 )", value: "福建省", open: true}, { // }, {pId: "0_0", id: "0_0_2", text: "福建省( 共2个 )", value: "福建省", open: true}, {
pId: "0_0_2", // pId: "0_0_2",
id: "0_0_2_0", // id: "0_0_2_0",
text: "莆田市", // text: "莆田市",
value: "莆田市", // value: "莆田市",
open: true // open: true
}, {pId: "0_0_2", id: "0_0_2_1", text: "泉州市", value: "泉州市", open: true}, { // }, {pId: "0_0_2", id: "0_0_2_1", text: "泉州市", value: "泉州市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_3", // id: "0_0_3",
text: "甘肃省( 共1个 )", // text: "甘肃省( 共1个 )",
value: "甘肃省", // value: "甘肃省",
open: true // open: true
}, {pId: "0_0_3", id: "0_0_3_0", text: "兰州市", value: "兰州市", open: true}, { // }, {pId: "0_0_3", id: "0_0_3_0", text: "兰州市", value: "兰州市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_4", // id: "0_0_4",
text: "广东省( 共5个 )", // text: "广东省( 共5个 )",
value: "广东省", // value: "广东省",
open: true // open: true
}, {pId: "0_0_4", id: "0_0_4_0", text: "东莞市", value: "东莞市", open: true}, { // }, {pId: "0_0_4", id: "0_0_4_0", text: "东莞市", value: "东莞市", open: true}, {
pId: "0_0_4", // pId: "0_0_4",
id: "0_0_4_1", // id: "0_0_4_1",
text: "广州市", // text: "广州市",
value: "广州市", // value: "广州市",
open: true // open: true
}]; // }];
//
/** // /**
* test_author_windy // * test_author_windy
**/ // **/
it("setValue", function () { // it("setValue", function () {
var widget = BI.Test.createWidget({ // var widget = BI.Test.createWidget({
type: "bi.list_tree_value_chooser_insert_combo", // type: "bi.list_tree_value_chooser_insert_combo",
width: 220, // width: 220,
itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
callback(items); // callback(items);
} // }
}); // });
widget.setValue([["中国", "北京市", "朝阳区"]]); // widget.setValue([["中国", "北京市", "朝阳区"]]);
expect(widget.getValue()).to.deep.equal([["中国", "北京市", "朝阳区"]]); // expect(widget.getValue()).to.deep.equal([["中国", "北京市", "朝阳区"]]);
widget.destroy(); // widget.destroy();
}); // });
//
/** // /**
* test_author_windy // * test_author_windy
**/ // **/
it("getValue", function () { // it("getValue", function () {
var widget = BI.Test.createWidget({ // var widget = BI.Test.createWidget({
type: "bi.list_tree_value_chooser_insert_combo", // type: "bi.list_tree_value_chooser_insert_combo",
width: 220, // width: 220,
itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
callback(items); // callback(items);
}, // },
value: [["中国", "北京市", "朝阳区"]] // value: [["中国", "北京市", "朝阳区"]]
}); // });
expect(widget.getValue()).to.deep.equal([["中国", "北京市", "朝阳区"]]); // expect(widget.getValue()).to.deep.equal([["中国", "北京市", "朝阳区"]]);
widget.destroy(); // widget.destroy();
}); // });
}); // });

252
src/component/treevaluechooser/__test__/combo.treevaluechooser.insert.test.js

@ -4,129 +4,129 @@
* Created by windy on 2019/9/25 * Created by windy on 2019/9/25
*/ */
describe("tree_value_chooser_insert_combo", function () { // describe("tree_value_chooser_insert_combo", function () {
//
var items = [{pId: "0", id: "0_0", text: "中国", value: "", open: true}, { // var items = [{pId: "0", id: "0_0", text: "中国", value: "", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_0", // id: "0_0_0",
text: "安徽省( 共1个 )", // text: "安徽省( 共1个 )",
value: "安徽省", // value: "安徽省",
open: true // open: true
}, {pId: "0_0_0", id: "0_0_0_0", text: "芜湖市", value: "芜湖市", open: true}, { // }, {pId: "0_0_0", id: "0_0_0_0", text: "芜湖市", value: "芜湖市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_1", // id: "0_0_1",
text: "北京市( 共6个 )", // text: "北京市( 共6个 )",
value: "北京市", // value: "北京市",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_0", text: "北京市区", value: "北京市区", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_0", text: "北京市区", value: "北京市区", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_1", // id: "0_0_1_1",
text: "朝阳区", // text: "朝阳区",
value: "朝阳区", // value: "朝阳区",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_2", text: "东城区", value: "东城区", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_2", text: "东城区", value: "东城区", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_3", // id: "0_0_1_3",
text: "海淀区4内", // text: "海淀区4内",
value: "海淀区4内", // value: "海淀区4内",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_4", text: "海淀区4外", value: "海淀区4外", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_4", text: "海淀区4外", value: "海淀区4外", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_5", // id: "0_0_1_5",
text: "石景山区", // text: "石景山区",
value: "石景山区", // value: "石景山区",
open: true // open: true
}, {pId: "0_0", id: "0_0_2", text: "福建省( 共2个 )", value: "福建省", open: true}, { // }, {pId: "0_0", id: "0_0_2", text: "福建省( 共2个 )", value: "福建省", open: true}, {
pId: "0_0_2", // pId: "0_0_2",
id: "0_0_2_0", // id: "0_0_2_0",
text: "莆田市", // text: "莆田市",
value: "莆田市", // value: "莆田市",
open: true // open: true
}, {pId: "0_0_2", id: "0_0_2_1", text: "泉州市", value: "泉州市", open: true}, { // }, {pId: "0_0_2", id: "0_0_2_1", text: "泉州市", value: "泉州市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_3", // id: "0_0_3",
text: "甘肃省( 共1个 )", // text: "甘肃省( 共1个 )",
value: "甘肃省", // value: "甘肃省",
open: true // open: true
}, {pId: "0_0_3", id: "0_0_3_0", text: "兰州市", value: "兰州市", open: true}, { // }, {pId: "0_0_3", id: "0_0_3_0", text: "兰州市", value: "兰州市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_4", // id: "0_0_4",
text: "广东省( 共5个 )", // text: "广东省( 共5个 )",
value: "广东省", // value: "广东省",
open: true // open: true
}, {pId: "0_0_4", id: "0_0_4_0", text: "东莞市", value: "东莞市", open: true}, { // }, {pId: "0_0_4", id: "0_0_4_0", text: "东莞市", value: "东莞市", open: true}, {
pId: "0_0_4", // pId: "0_0_4",
id: "0_0_4_1", // id: "0_0_4_1",
text: "广州市", // text: "广州市",
value: "广州市", // value: "广州市",
open: true // open: true
}]; // }];
//
var itemSelectorGetter = function (array) { // var itemSelectorGetter = function (array) {
return BI.map(array, function (idx, num) { // return BI.map(array, function (idx, num) {
return ".bi-multi-select-popup-view .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; // return ".bi-multi-select-popup-view .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")";
}); // });
}; // };
//
var searchItemSelectorGetter = function (array) { // var searchItemSelectorGetter = function (array) {
return BI.map(array, function (idx, num) { // return BI.map(array, function (idx, num) {
return ".bi-multi-select-search-pane .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; // return ".bi-multi-select-search-pane .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")";
}); // });
}; // };
//
/** // /**
* test_author_windy // * test_author_windy
**/ // **/
it("setValue", function () { // it("setValue", function () {
var widget = BI.Test.createWidget({ // var widget = BI.Test.createWidget({
type: "bi.tree_value_chooser_insert_combo", // type: "bi.tree_value_chooser_insert_combo",
width: 220, // width: 220,
itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
callback(items); // callback(items);
} // }
}); // });
widget.setValue({ // widget.setValue({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
expect(widget.getValue()).to.deep.equal({ // expect(widget.getValue()).to.deep.equal({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
widget.destroy(); // widget.destroy();
}); // });
//
/** // /**
* test_author_windy // * test_author_windy
**/ // **/
it("getValue", function () { // it("getValue", function () {
var widget = BI.Test.createWidget({ // var widget = BI.Test.createWidget({
type: "bi.tree_value_chooser_insert_combo", // type: "bi.tree_value_chooser_insert_combo",
width: 220, // width: 220,
itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
callback(items); // callback(items);
}, // },
value: { // value: {
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
} // }
}); // });
expect(widget.getValue()).to.deep.equal({ // expect(widget.getValue()).to.deep.equal({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
widget.destroy(); // widget.destroy();
}); // });
}); // });

252
src/component/treevaluechooser/__test__/combo.treevaluechooser.test.js

@ -4,129 +4,129 @@
* Created by windy on 2019/9/25 * Created by windy on 2019/9/25
*/ */
describe("tree_value_chooser_combo", function () { // describe("tree_value_chooser_combo", function () {
//
var items = [{pId: "0", id: "0_0", text: "中国", value: "", open: true}, { // var items = [{pId: "0", id: "0_0", text: "中国", value: "", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_0", // id: "0_0_0",
text: "安徽省( 共1个 )", // text: "安徽省( 共1个 )",
value: "安徽省", // value: "安徽省",
open: true // open: true
}, {pId: "0_0_0", id: "0_0_0_0", text: "芜湖市", value: "芜湖市", open: true}, { // }, {pId: "0_0_0", id: "0_0_0_0", text: "芜湖市", value: "芜湖市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_1", // id: "0_0_1",
text: "北京市( 共6个 )", // text: "北京市( 共6个 )",
value: "北京市", // value: "北京市",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_0", text: "北京市区", value: "北京市区", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_0", text: "北京市区", value: "北京市区", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_1", // id: "0_0_1_1",
text: "朝阳区", // text: "朝阳区",
value: "朝阳区", // value: "朝阳区",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_2", text: "东城区", value: "东城区", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_2", text: "东城区", value: "东城区", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_3", // id: "0_0_1_3",
text: "海淀区4内", // text: "海淀区4内",
value: "海淀区4内", // value: "海淀区4内",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_4", text: "海淀区4外", value: "海淀区4外", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_4", text: "海淀区4外", value: "海淀区4外", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_5", // id: "0_0_1_5",
text: "石景山区", // text: "石景山区",
value: "石景山区", // value: "石景山区",
open: true // open: true
}, {pId: "0_0", id: "0_0_2", text: "福建省( 共2个 )", value: "福建省", open: true}, { // }, {pId: "0_0", id: "0_0_2", text: "福建省( 共2个 )", value: "福建省", open: true}, {
pId: "0_0_2", // pId: "0_0_2",
id: "0_0_2_0", // id: "0_0_2_0",
text: "莆田市", // text: "莆田市",
value: "莆田市", // value: "莆田市",
open: true // open: true
}, {pId: "0_0_2", id: "0_0_2_1", text: "泉州市", value: "泉州市", open: true}, { // }, {pId: "0_0_2", id: "0_0_2_1", text: "泉州市", value: "泉州市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_3", // id: "0_0_3",
text: "甘肃省( 共1个 )", // text: "甘肃省( 共1个 )",
value: "甘肃省", // value: "甘肃省",
open: true // open: true
}, {pId: "0_0_3", id: "0_0_3_0", text: "兰州市", value: "兰州市", open: true}, { // }, {pId: "0_0_3", id: "0_0_3_0", text: "兰州市", value: "兰州市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_4", // id: "0_0_4",
text: "广东省( 共5个 )", // text: "广东省( 共5个 )",
value: "广东省", // value: "广东省",
open: true // open: true
}, {pId: "0_0_4", id: "0_0_4_0", text: "东莞市", value: "东莞市", open: true}, { // }, {pId: "0_0_4", id: "0_0_4_0", text: "东莞市", value: "东莞市", open: true}, {
pId: "0_0_4", // pId: "0_0_4",
id: "0_0_4_1", // id: "0_0_4_1",
text: "广州市", // text: "广州市",
value: "广州市", // value: "广州市",
open: true // open: true
}]; // }];
//
var itemSelectorGetter = function (array) { // var itemSelectorGetter = function (array) {
return BI.map(array, function (idx, num) { // return BI.map(array, function (idx, num) {
return ".bi-multi-select-popup-view .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; // return ".bi-multi-select-popup-view .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")";
}); // });
}; // };
//
var searchItemSelectorGetter = function (array) { // var searchItemSelectorGetter = function (array) {
return BI.map(array, function (idx, num) { // return BI.map(array, function (idx, num) {
return ".bi-multi-select-search-pane .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; // return ".bi-multi-select-search-pane .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")";
}); // });
}; // };
//
/** // /**
* test_author_windy // * test_author_windy
**/ // **/
it("setValue", function () { // it("setValue", function () {
var widget = BI.Test.createWidget({ // var widget = BI.Test.createWidget({
type: "bi.tree_value_chooser_combo", // type: "bi.tree_value_chooser_combo",
width: 220, // width: 220,
itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
callback(items); // callback(items);
} // }
}); // });
widget.setValue({ // widget.setValue({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
expect(widget.getValue()).to.deep.equal({ // expect(widget.getValue()).to.deep.equal({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
widget.destroy(); // widget.destroy();
}); // });
//
/** // /**
* test_author_windy // * test_author_windy
**/ // **/
it("getValue", function () { // it("getValue", function () {
var widget = BI.Test.createWidget({ // var widget = BI.Test.createWidget({
type: "bi.tree_value_chooser_combo", // type: "bi.tree_value_chooser_combo",
width: 220, // width: 220,
itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
callback(items); // callback(items);
}, // },
value: { // value: {
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
} // }
}); // });
expect(widget.getValue()).to.deep.equal({ // expect(widget.getValue()).to.deep.equal({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
widget.destroy(); // widget.destroy();
}); // });
}); // });

268
src/component/treevaluechooser/__test__/pane.treevaluechooser.test.js

@ -4,137 +4,137 @@
* Created by windy on 2019/9/25 * Created by windy on 2019/9/25
*/ */
describe("tree_value_chooser_pane", function () { // describe("tree_value_chooser_pane", function () {
//
var items = [{pId: "0", id: "0_0", text: "中国", value: "", open: true}, { // var items = [{pId: "0", id: "0_0", text: "中国", value: "", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_0", // id: "0_0_0",
text: "安徽省( 共1个 )", // text: "安徽省( 共1个 )",
value: "安徽省", // value: "安徽省",
open: true // open: true
}, {pId: "0_0_0", id: "0_0_0_0", text: "芜湖市", value: "芜湖市", open: true}, { // }, {pId: "0_0_0", id: "0_0_0_0", text: "芜湖市", value: "芜湖市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_1", // id: "0_0_1",
text: "北京市( 共6个 )", // text: "北京市( 共6个 )",
value: "北京市", // value: "北京市",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_0", text: "北京市区", value: "北京市区", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_0", text: "北京市区", value: "北京市区", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_1", // id: "0_0_1_1",
text: "朝阳区", // text: "朝阳区",
value: "朝阳区", // value: "朝阳区",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_2", text: "东城区", value: "东城区", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_2", text: "东城区", value: "东城区", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_3", // id: "0_0_1_3",
text: "海淀区4内", // text: "海淀区4内",
value: "海淀区4内", // value: "海淀区4内",
open: true // open: true
}, {pId: "0_0_1", id: "0_0_1_4", text: "海淀区4外", value: "海淀区4外", open: true}, { // }, {pId: "0_0_1", id: "0_0_1_4", text: "海淀区4外", value: "海淀区4外", open: true}, {
pId: "0_0_1", // pId: "0_0_1",
id: "0_0_1_5", // id: "0_0_1_5",
text: "石景山区", // text: "石景山区",
value: "石景山区", // value: "石景山区",
open: true // open: true
}, {pId: "0_0", id: "0_0_2", text: "福建省( 共2个 )", value: "福建省", open: true}, { // }, {pId: "0_0", id: "0_0_2", text: "福建省( 共2个 )", value: "福建省", open: true}, {
pId: "0_0_2", // pId: "0_0_2",
id: "0_0_2_0", // id: "0_0_2_0",
text: "莆田市", // text: "莆田市",
value: "莆田市", // value: "莆田市",
open: true // open: true
}, {pId: "0_0_2", id: "0_0_2_1", text: "泉州市", value: "泉州市", open: true}, { // }, {pId: "0_0_2", id: "0_0_2_1", text: "泉州市", value: "泉州市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_3", // id: "0_0_3",
text: "甘肃省( 共1个 )", // text: "甘肃省( 共1个 )",
value: "甘肃省", // value: "甘肃省",
open: true // open: true
}, {pId: "0_0_3", id: "0_0_3_0", text: "兰州市", value: "兰州市", open: true}, { // }, {pId: "0_0_3", id: "0_0_3_0", text: "兰州市", value: "兰州市", open: true}, {
pId: "0_0", // pId: "0_0",
id: "0_0_4", // id: "0_0_4",
text: "广东省( 共5个 )", // text: "广东省( 共5个 )",
value: "广东省", // value: "广东省",
open: true // open: true
}, {pId: "0_0_4", id: "0_0_4_0", text: "东莞市", value: "东莞市", open: true}, { // }, {pId: "0_0_4", id: "0_0_4_0", text: "东莞市", value: "东莞市", open: true}, {
pId: "0_0_4", // pId: "0_0_4",
id: "0_0_4_1", // id: "0_0_4_1",
text: "广州市", // text: "广州市",
value: "广州市", // value: "广州市",
open: true // open: true
}]; // }];
//
var itemSelectorGetter = function (array) { // var itemSelectorGetter = function (array) {
return BI.map(array, function (idx, num) { // return BI.map(array, function (idx, num) {
return ".bi-multi-select-popup-view .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; // return ".bi-multi-select-popup-view .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")";
}); // });
}; // };
//
var searchItemSelectorGetter = function (array) { // var searchItemSelectorGetter = function (array) {
return BI.map(array, function (idx, num) { // return BI.map(array, function (idx, num) {
return ".bi-multi-select-search-pane .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")"; // return ".bi-multi-select-search-pane .bi-loader .bi-button-group .bi-multi-select-item:nth-child(" + num + ")";
}); // });
}; // };
//
/** // /**
* test_author_windy // * test_author_windy
**/ // **/
it("setValue", function () { // it("setValue", function () {
var widget = BI.Test.createWidget({ // var widget = BI.Test.createWidget({
type: "bi.tree_value_chooser_pane", // type: "bi.tree_value_chooser_pane",
width: 220, // width: 220,
items: items, // items: items,
// itemsCreator: function (op, callback) { // // itemsCreator: function (op, callback) {
// callback(items); // // callback(items);
// } // // }
}); // });
widget.setSelectedValue({ // widget.setSelectedValue({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
expect(widget.getValue()).to.deep.equal({ // expect(widget.getValue()).to.deep.equal({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
widget.destroy(); // widget.destroy();
}); // });
//
/** // /**
* test_author_windy // * test_author_windy
**/ // **/
it("getValue", function () { // it("getValue", function () {
var widget = BI.Test.createWidget({ // var widget = BI.Test.createWidget({
type: "bi.tree_value_chooser_pane", // type: "bi.tree_value_chooser_pane",
width: 220, // width: 220,
itemsCreator: function (op, callback) { // itemsCreator: function (op, callback) {
callback(items); // callback(items);
}, // },
value: { // value: {
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
} // }
}); // });
widget.setSelectedValue({ // widget.setSelectedValue({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
expect(widget.getValue()).to.deep.equal({ // expect(widget.getValue()).to.deep.equal({
"中国": { // "中国": {
"北京市": { // "北京市": {
"朝阳区": {} // "朝阳区": {}
} // }
} // }
}); // });
widget.destroy(); // widget.destroy();
}); // });
}); // });

6
src/widget/editor/__test__/editor.search.test.js

@ -4,12 +4,6 @@
* Created by windy on 2019/9/9 * Created by windy on 2019/9/9
*/ */
/**
* @author windy
* @version 2.0
* Created by windy on 2019/9/6
*/
describe("searchEditor", function () { describe("searchEditor", function () {
/** /**

Loading…
Cancel
Save