Browse Source

Merge pull request #1027 in VISUAL/fineui from ~WINDY/fineui:master to master

* commit '840f255de6ec33cf3d23998cd0240394da75b111':
  update
  fix: 按照comment修改
  BI-48231 number_interval也补充一下
  fix: 按照comment修改
  BI-48236 test: 测试text和button的点击方法
es6
guy 5 years ago
parent
commit
99074af2c9
  1. 28
      karma.conf.js
  2. 5
      src/css/widget/numberinterval/numberinterval.css
  3. 3
      src/less/widget/numberinterval/numberinterval.less
  4. 2
      src/widget/numberinterval/numberinterval.js
  5. 12
      test/utils.js
  6. 25
      test/widget/button.test.js
  7. 29
      test/widget/text.test.js

28
karma.conf.js

@ -26,6 +26,24 @@ module.exports = function (config) {
"src/core/plugin.js", "src/core/plugin.js",
"src/core/**/*.js", "src/core/**/*.js",
"src/data/**/*.js", "src/data/**/*.js",
"src/data/**/*.js",
"src/data/**/*.js",
"src/third/**/*.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
"src/base/single/button/button.basic.js",
"src/base/single/button/button.node.js",
"src/base/single/tip/tip.js",
"src/base/combination/group.button.js",
"src/base/combination/tree.button.js",
"src/base/tree/ztree/treeview.js",
"src/base/tree/ztree/asynctree.js",
"src/base/tree/ztree/parttree.js",
"src/base/tree/ztree/list/listtreeview.js",
"src/base/tree/ztree/list/listasynctree.js",
"src/base/tree/ztree/list/listparttree.js",
"src/base/**/*.js",
"src/**/*.test.js", "src/**/*.test.js",
"test/**/*.js" "test/**/*.js"
], ],
@ -36,7 +54,8 @@ module.exports = function (config) {
preprocessors: { preprocessors: {
"src/core/alias.js": "coverage", "src/core/alias.js": "coverage",
"src/core/base.js": "coverage", "src/core/base.js": "coverage",
"src/core/func/date.js": "coverage" "src/core/func/date.js": "coverage",
"src/base/**/*.js": "coverage"
}, },
@ -45,13 +64,18 @@ module.exports = function (config) {
// available reporters: https://npmjs.org/browse/keyword/karma-reporter // available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["progress", "coverage"], reporters: ["progress", "coverage"],
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 300000,
browserNoActivityTimeout : 300000,
coverageReporter: { coverageReporter: {
// specify a common output directory // specify a common output directory
dir: "coverage/", dir: "coverage/",
reporters: [ reporters: [
// reporters not supporting the `file` property // reporters not supporting the `file` property
{ type: "html", subdir: "report-html" }, { type: "html", subdir: "report-html" },
{ type: "json-summary", subdir: "report-json-summary" } { type: "json-summary", subdir: "report-json-summary" },
{ type: "cobertura", subdir: "report-cobertura"}
] ]
}, },

5
src/css/widget/numberinterval/numberinterval.css

@ -1,3 +1,8 @@
.bi-number-interval.hack {
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
.bi-number-interval .number-interval-small-editor { .bi-number-interval .number-interval-small-editor {
-moz-border-radius-topleft: 2px; -moz-border-radius-topleft: 2px;
-webkit-border-top-left-radius: 2px; -webkit-border-top-left-radius: 2px;

3
src/less/widget/numberinterval/numberinterval.less

@ -1,6 +1,9 @@
@import "../../index"; @import "../../index";
.bi-number-interval { .bi-number-interval {
&.hack {
.border-radius(0px);
}
& .number-interval-small-editor { & .number-interval-small-editor {
.border-corner-left-radius(2px, 2px); .border-corner-left-radius(2px, 2px);
} }

2
src/widget/numberinterval/numberinterval.js

@ -23,7 +23,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.NumberInterval.superclass._defaultConfig.apply(this, arguments); var conf = BI.NumberInterval.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
extraCls: "bi-number-interval", extraCls: "bi-number-interval" + (BI.isIE() && BI.getIEVersion() < 10) ? " hack" : "",
height: 24, height: 24,
validation: "valid", validation: "valid",
closeMin: true, closeMin: true,

12
test/utils.js

@ -0,0 +1,12 @@
!(function () {
BI.Test = {};
_.extend(BI.Test, {
createWidget: function (widgetJson) {
var widget = BI.createWidget(BI.extend(widgetJson, {
root: true
}));
widget.element.appendTo("body");
return widget;
}
})
})();

25
test/widget/button.test.js

@ -0,0 +1,25 @@
/**
* Created by windy on 2018/01/23.
*/
describe("ButtonTest", function () {
/**
* test_author_windy
*/
it("EventClickTest", function (done) {
var button = BI.Test.createWidget({
type: "bi.button",
text: "CCC",
handler: function () {
this.setText("click");
}
});
BI.nextTick(function () {
button.element.click();
expect(button.element.children(".bi-text").text()).to.equal("click");
button.destroy();
done();
});
});
});

29
test/widget/text.test.js

@ -0,0 +1,29 @@
/**
* Created by windy on 2018/01/23.
*/
describe("TextTest", function () {
/**
* test_author_windy
*/
it("setText", function () {
var text = BI.Test.createWidget({
type: "bi.text"
});
text.setText("AAA");
expect(text.element.text()).to.equal("AAA");
text.destroy();
});
/**
* test_author_windy
*/
it("setStyle", function () {
var text = BI.Test.createWidget({
type: "bi.text"
});
text.setStyle({"color": "red"});
expect(text.element.getStyle("color")).to.equal("rgb(255, 0, 0)");
text.destroy();
});
});
Loading…
Cancel
Save