forked from fanruan/fineui
windy
5 years ago
4 changed files with 89 additions and 2 deletions
@ -0,0 +1,12 @@
|
||||
!(function () { |
||||
BI.Test = {}; |
||||
_.extend(BI.Test, { |
||||
createWidget: function (widgetJson) { |
||||
var widget = BI.createWidget(widgetJson); |
||||
widget._isRoot = true; |
||||
widget._mount(); |
||||
widget.element.appendTo("body"); |
||||
return widget; |
||||
} |
||||
}) |
||||
})(); |
@ -0,0 +1,24 @@
|
||||
/** |
||||
* 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[0].querySelector(".bi-text").textContent).to.equal("click"); |
||||
done(); |
||||
}); |
||||
|
||||
}); |
||||
}); |
@ -0,0 +1,27 @@
|
||||
/** |
||||
* 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[0].textContent).to.equal("AAA"); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("setStyle", function () { |
||||
var text = BI.Test.createWidget({ |
||||
type: "bi.text" |
||||
}); |
||||
text.setStyle({"color": "red"}); |
||||
expect(text.element[0].style.color).to.equal("red"); |
||||
}); |
||||
}); |
Loading…
Reference in new issue