forked from fanruan/fineui
Browse Source
* commit '840f255de6ec33cf3d23998cd0240394da75b111': update fix: 按照comment修改 BI-48231 number_interval也补充一下 fix: 按照comment修改 BI-48236 test: 测试text和button的点击方法master
guy
6 years ago
7 changed files with 101 additions and 3 deletions
@ -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; |
||||
} |
||||
}) |
||||
})(); |
@ -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(); |
||||
}); |
||||
|
||||
}); |
||||
}); |
@ -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…
Reference in new issue