mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
added tests for documentation
This commit is contained in:
parent
3d6a099d6e
commit
dc66687149
5 changed files with 49 additions and 8 deletions
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
<h2>Example</h2>
|
||||
{{{exampleDescription}}}
|
||||
|
||||
<WIKI:SOURCE style="display:block;">
|
||||
{{{example}}}
|
||||
</WIKI:SOURCE>
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
<li><tt>{{name}}:{{#type}}{{type}}{{/type}}{{^type}}:*{{/type}}{{#default}}={{default}}{{/default}}</tt>: {{{description}}}</li>
|
||||
{{/param}}
|
||||
</ul>
|
||||
{{{paramDescription}}}
|
||||
|
||||
<h3>CSS</h3>
|
||||
{{{css}}}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
'<li class="tab selected" to="angular"><angular/></li>' +
|
||||
'<li class="tab" to="plain">plain</li>' +
|
||||
'<li class="tab" to="source">source</li>' +
|
||||
'<li class="pane selected angular">' + html + '</li>' +
|
||||
'<li class="pane selected angular example">' + html + '</li>' +
|
||||
'<li class="pane plain" ng:non-bindable>' + html + '</li>' +
|
||||
'<li class="pane source" ng:non-bindable><pre class="brush: js; html-script: true"></pre></li>' +
|
||||
'</ul>');
|
||||
|
|
|
|||
|
|
@ -116,29 +116,45 @@ extend(angularValidator, {
|
|||
*
|
||||
* * `data`: data object as passed from validate function
|
||||
*
|
||||
* @css ng-input-indicator-wait
|
||||
* @css ng-input-indicator-wait, ng-validation-error
|
||||
*
|
||||
* @exampleDescription
|
||||
* <pre>
|
||||
* function myValidator (value, callback) {
|
||||
* function myValidator (inputToValidate, validationDone) {
|
||||
* // simulate delayed response, validate on even input length
|
||||
* setTimeout(function(){
|
||||
* callback(value.length % 2);
|
||||
* }, 2000);
|
||||
* validationDone(inputToValidate.length % 2);
|
||||
* }, 500);
|
||||
* };
|
||||
* </pre>
|
||||
*
|
||||
* @example
|
||||
* <script>
|
||||
* function myValidator(value, callback) {
|
||||
* function myValidator(inputToValidate, validationDone) {
|
||||
* setTimeout(function(){
|
||||
* callback(value.length % 2);
|
||||
* }, 2000);
|
||||
* validationDone(inputToValidate.length % 2);
|
||||
* }, 500);
|
||||
* }
|
||||
* </script>
|
||||
* This input is validated asynchronously:
|
||||
* <input name="text" ng:validate="asynchronous:$window.myValidator">
|
||||
*
|
||||
* @scenario
|
||||
* it('should change color in delayed way', function(){
|
||||
* var textBox = element('.example :input');
|
||||
* expect(textBox.attr('className')).not().toMatch(/ng-input-indicator-wait/);
|
||||
* expect(textBox.attr('className')).not().toMatch(/ng-validation-error/);
|
||||
*
|
||||
* input('text').enter('X');
|
||||
* expect(textBox.attr('className')).toMatch(/ng-input-indicator-wait/);
|
||||
*
|
||||
* pause(.6);
|
||||
*
|
||||
* expect(textBox.attr('className')).not().toMatch(/ng-input-indicator-wait/);
|
||||
* expect(textBox.attr('className')).toMatch(/ng-validation-error/);
|
||||
*
|
||||
* });
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* cache is attached to the element
|
||||
|
|
|
|||
|
|
@ -268,6 +268,17 @@ angularWidget('option', function(){
|
|||
* <ng:include src="url"></ng:include>
|
||||
*
|
||||
* @scenario
|
||||
* it('should load date filter', function(){
|
||||
* expect(element('.example ng\\:include').text()).toMatch(/angular\.filter\.date/);
|
||||
* });
|
||||
* it('should change to hmtl filter', function(){
|
||||
* select('url').option('angular.filter.html.html');
|
||||
* expect(element('.example ng\\:include').text()).toMatch(/angular\.filter\.html/);
|
||||
* });
|
||||
* it('should change to blank', function(){
|
||||
* select('url').option('(blank)');
|
||||
* expect(element('.example ng\\:include').text()).toEqual('');
|
||||
* });
|
||||
*/
|
||||
angularWidget('ng:include', function(element){
|
||||
var compiler = this,
|
||||
|
|
@ -328,6 +339,11 @@ angularWidget('ng:include', function(element){
|
|||
* <any ng:switch-when="matchValueN"/>...</any>
|
||||
*
|
||||
* @param {*} on expression to match against <tt>ng:switch-when</tt>.
|
||||
* @paramDescription
|
||||
* On child elments add:
|
||||
*
|
||||
* * `ng:switch-when`: the case statement to match against. If match then this
|
||||
* case will be displayed.
|
||||
*
|
||||
* @example
|
||||
<select name="switch">
|
||||
|
|
@ -343,6 +359,13 @@ angularWidget('ng:include', function(element){
|
|||
</code>
|
||||
*
|
||||
* @scenario
|
||||
* it('should start in settings', function(){
|
||||
* expect(element('.example ng\\:switch').text()).toEqual('Settings Div');
|
||||
* });
|
||||
* it('should change to home', function(){
|
||||
* select('switch').option('home');
|
||||
* expect(element('.example ng\\:switch').text()).toEqual('Home Span');
|
||||
* });
|
||||
*/
|
||||
var ngSwitch = angularWidget('ng:switch', function (element){
|
||||
var compiler = this,
|
||||
|
|
|
|||
Loading…
Reference in a new issue