Skip to content
Browse files

Add test cases for new API.

  • Loading branch information...
1 parent 1a5dcc9 commit 2c9168bcd345f6b8e42ea3ed848d4b7dea1b2196 @mytharcher mytharcher committed Jul 21, 2012
Showing with 37 additions and 21 deletions.
  1. +37 −21 test/esui/checkbox_and_radio.html
View
58 test/esui/checkbox_and_radio.html
@@ -26,27 +26,35 @@
<body>
<div class="header">[ESUI EXAMPLE] - CheckBox and Radio</div>
<div class="main">
- <table cellpadding="5" cellspacing="0" border="0">
- <tr>
- <td><input type="checkbox" value="1" ui="type:CheckBox;id:cb1" title="one" name="num"/></td>
- <td><input type="checkbox" value="2" ui="type:CheckBox;id:cb2" title="two" name="num"/></td>
- <td><input type="checkbox" value="3" ui="type:CheckBox;id:cb3" title="three" name="num"/></td>
- <td><div ui="type:Button;id:currCb">当前选中</div></td>
- <td><div ui="type:Button;id:selAll">全选</div></td>
- <td><div ui="type:Button;id:selInv">反选</div></td>
- </tr>
- <tr>
- <td><input type="radio" value="1" ui="type:Radio;id:r1" title="one" name="num2"/></td>
- <td><input type="radio" value="2" ui="type:Radio;id:r2" title="two" name="num2"/></td>
- <td><input type="radio" value="3" ui="type:Radio;id:r3" title="three" name="num2"/></td>
- <td colspan="3"><div ui="type:Button;id:currRadio">当前选中</div></td>
- </tr>
- <tr>
- <td><input type="radio" value="1" ui="type:Radio;id:x1" title="one"/></td>
- <td><input type="checkbox" value="3" ui="type:CheckBox;id:x3" title="three"/></td>
- <td colspan="3"><div ui="type:Button;id:xRender">Call Render Again</div></td>
- </tr>
- </table>
+ <p>
+ <input type="checkbox" value="1" ui="type:CheckBox;id:cb1" title="one" name="num"/>
+ <input type="checkbox" value="2" ui="type:CheckBox;id:cb2" title="two" name="num"/>
+ <input type="checkbox" value="3" ui="type:CheckBox;id:cb3" title="three" name="num"/>
+ </p>
+ <div>
+ <div ui="type:Button;id:currCb">当前选中</div>
+ <div ui="type:Button;id:selAll">全选</div>
+ <div ui="type:Button;id:selInv">反选</div>
+ <div ui="type:Button;id:selValues">选中值为2,3的项</div>
+ </div>
+
+ <p>
+ <input type="radio" value="1" ui="type:Radio;id:r1" title="one" name="num2"/>
+ <input type="radio" value="2" ui="type:Radio;id:r2" title="two" name="num2"/>
+ <input type="radio" value="3" ui="type:Radio;id:r3" title="three" name="num2"/>
+ </p>
+ <div>
+ <div ui="type:Button;id:currRadio">当前选中</div>
+ <div ui="type:Button;id:radioSelValues">选中值为2的项</div>
+ </div>
+
+ <p>
+ <input type="radio" value="1" ui="type:Radio;id:x1" title="one"/>
+ <input type="checkbox" value="3" ui="type:CheckBox;id:x3" title="three"/>
+ </p>
+ <div>
+ <div ui="type:Button;id:xRender">Call Render Again</div>
+ </div>
</div>
<script>
@@ -66,13 +74,21 @@
esui.get('cb1').getGroup().selectInverse();
};
+esui.get('selValues').onclick = function () {
+ esui.get('cb1').getGroup().selectByValues([2, 3]);
+};
+
esui.get('currRadio').onclick = function () {
alert( 'checked one:' + esui.get('r1').isChecked() );
alert( 'checked two:' + esui.get('r2').isChecked() );
alert( 'checked three:' + esui.get('r3').isChecked() );
alert( 'group value:' + esui.get('r3').getGroup().getValue() );
};
+esui.get('radioSelValues').onclick = function () {
+ esui.get('r2').getGroup().selectByValues([2]);
+};
+
esui.get('xRender').onclick = function() {
esui.get('x1').render();
esui.get('x3').render();

0 comments on commit 2c9168b

Please sign in to comment.
Something went wrong with that request. Please try again.