UI Class
ui测试类;
Defined in:
Module: uiModule
input\code\ui\uicode.js:10
Constructor
UI
UI
()
Example:
<html>
<style>
#container {
color:#fff;
width:200px;
height:30px;
line-height: 30px;
border-radius: 5px;
background: #5bc0de;
text-align: center;
}
</style>
<h2>UI测试1</h2>
<div id='container'>html render</div>
</html>
<script>
$(function(){
//ui code输出
var ui = new UI("UI测试");
$('#container').text(ui.render());
//log输出
log('this is a message');
//expect === 输出
expect(1).toBe(true);
//expect == 输出
expect(1).toEqual(true);
});
</script>
<html>
<style>
#container {
color:#fff;
width:200px;
height:30px;
line-height: 30px;
border-radius: 5px;
background: #f0ad4e;
text-align: center;
}
</style>
<h2>UI测试2</h2>
<div id='container'></div>
</html>
<script>
//ui code输出
var ui = new UI("UI测试2");
document.getElementById('container').innerText = ui.render();
</script>
Methods
init
init
(
-
content
)
ui初始化方法
Parameters:
name | type | flag | description |
---|---|---|---|
content
| String | 内容 |
render
render
()
String
渲染方法
Returns:
[String]
渲染后的html