Skip to content

Commit

Permalink
chore(formating): clean code to be function() {
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery authored and IgorMinar committed Oct 11, 2011
1 parent 4f78fd6 commit fd822bd
Show file tree
Hide file tree
Showing 107 changed files with 942 additions and 941 deletions.
10 changes: 5 additions & 5 deletions docs/content/api/angular.inputType.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ All `inputType` widgets support:
<doc:example>
<doc:source>
<script>
angular.inputType('json', function(){
this.$parseView = function(){
angular.inputType('json', function() {
this.$parseView = function() {
try {
this.$modelValue = angular.fromJson(this.$viewValue);
if (this.$error.JSON) {
Expand All @@ -52,12 +52,12 @@ All `inputType` widgets support:
}
}

this.$parseModel = function(){
this.$parseModel = function() {
this.$viewValue = angular.toJson(this.$modelValue);
}
});

function Ctrl(){
function Ctrl() {
this.data = {
framework:'angular',
codenames:'supper-powers'
Expand All @@ -81,7 +81,7 @@ All `inputType` widgets support:
</div>
</doc:source>
<doc:scenario>
it('should invalidate on wrong input', function(){
it('should invalidate on wrong input', function() {
expect(element('form[name=myForm]').prop('className')).toMatch('ng-valid');
input('data').enter('{}');
expect(binding('data')).toEqual('data={\n }');
Expand Down
10 changes: 5 additions & 5 deletions docs/content/cookbook/advancedform.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ detection, and preventing invalid form submission.
<doc:example>
<doc:source>
<script>
function UserForm(){
function UserForm() {
this.state = /^\w\w$/;
this.zip = /^\d\d\d\d\d$/;
this.master = {
Expand All @@ -28,11 +28,11 @@ detection, and preventing invalid form submission.
}

UserForm.prototype = {
cancel: function(){
cancel: function() {
this.form = angular.copy(this.master);
},

save: function(){
save: function() {
this.master = this.form;
this.cancel();
}
Expand Down Expand Up @@ -76,7 +76,7 @@ detection, and preventing invalid form submission.
</div>
</doc:source>
<doc:scenario>
it('should enable save button', function(){
it('should enable save button', function() {
expect(element(':button:contains(Save)').attr('disabled')).toBeTruthy();
input('form.name').enter('');
expect(element(':button:contains(Save)').attr('disabled')).toBeTruthy();
Expand All @@ -85,7 +85,7 @@ detection, and preventing invalid form submission.
element(':button:contains(Save)').click();
expect(element(':button:contains(Save)').attr('disabled')).toBeTruthy();
});
it('should enable cancel button', function(){
it('should enable cancel button', function() {
expect(element(':button:contains(Cancel)').attr('disabled')).toBeTruthy();
input('form.name').enter('change');
expect(element(':button:contains(Cancel)').attr('disabled')).toBeFalsy();
Expand Down
8 changes: 4 additions & 4 deletions docs/content/cookbook/deeplinking.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The two partials are defined in the following URLs:

function WelcomeCntl($route){}
WelcomeCntl.prototype = {
greet: function(){
greet: function() {
alert("Hello " + this.person.name);
}
};
Expand All @@ -67,11 +67,11 @@ The two partials are defined in the following URLs:
this.cancel();
}
SettingsCntl.prototype = {
cancel: function(){
cancel: function() {
this.form = angular.copy(this.person);
},

save: function(){
save: function() {
angular.copy(this.form, this.person);
this.$location.path('/welcome');
}
Expand All @@ -89,7 +89,7 @@ The two partials are defined in the following URLs:
</div>
</doc:source>
<doc:scenario>
it('should navigate to URL', function(){
it('should navigate to URL', function() {
element('a:contains(Welcome)').click();
expect(element('ng\\:view').text()).toMatch(/Hello anonymous/);
element('a:contains(Settings)').click();
Expand Down
12 changes: 6 additions & 6 deletions docs/content/cookbook/form.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ allow a user to enter data.
<doc:example>
<doc:source>
<script>
function FormController(){
function FormController() {
this.user = {
name: 'John Smith',
address:{line1: '123 Main St.', city:'Anytown', state:'AA', zip:'12345'},
Expand Down Expand Up @@ -53,22 +53,22 @@ allow a user to enter data.

</doc:source>
<doc:scenario>
it('should show debug', function(){
it('should show debug', function() {
expect(binding('user')).toMatch(/John Smith/);
});
it('should add contact', function(){
it('should add contact', function() {
using('.example').element('a:contains(add)').click();
using('.example div:last').input('contact.value').enter('[email protected]');
expect(binding('user')).toMatch(/\(234\) 555\-1212/);
expect(binding('user')).toMatch(/[email protected]/);
});

it('should remove contact', function(){
it('should remove contact', function() {
using('.example').element('a:contains(X)').click();
expect(binding('user')).not().toMatch(/\(234\) 555\-1212/);
});

it('should validate zip', function(){
it('should validate zip', function() {
expect(using('.example').
element(':input[ng\\:model="user.address.zip"]').
prop('className')).not().toMatch(/ng-invalid/);
Expand All @@ -78,7 +78,7 @@ allow a user to enter data.
prop('className')).toMatch(/ng-invalid/);
});

it('should validate state', function(){
it('should validate state', function() {
expect(using('.example').element(':input[ng\\:model="user.address.state"]').prop('className'))
.not().toMatch(/ng-invalid/);
using('.example').input('user.address.state').enter('XXX');
Expand Down
4 changes: 2 additions & 2 deletions docs/content/cookbook/helloworld.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<doc:example>
<doc:source>
<script>
function HelloCntl(){
function HelloCntl() {
this.name = 'World';
}
</script>
Expand All @@ -17,7 +17,7 @@
</div>
</doc:source>
<doc:scenario>
it('should change the binding when user enters text', function(){
it('should change the binding when user enters text', function() {
expect(binding('name')).toEqual('World');
input('name').enter('angular');
expect(binding('name')).toEqual('angular');
Expand Down
8 changes: 4 additions & 4 deletions docs/content/cookbook/mvc.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ no connection between the controller and the view.
this.setUrl();
}
},
reset: function(){
reset: function() {
this.board = [
['', '', ''],
['', '', ''],
Expand All @@ -46,7 +46,7 @@ no connection between the controller and the view.
this.winner = '';
this.setUrl();
},
grade: function(){
grade: function() {
var b = this.board;
this.winner =
row(0) || row(1) || row(2) ||
Expand All @@ -57,7 +57,7 @@ no connection between the controller and the view.
function diagonal(i) { return same(b[0][1-i], b[1][1], b[2][1+i]);}
function same(a, b, c) { return (a==b && b==c) ? a : '';};
},
setUrl: function(){
setUrl: function() {
var rows = [];
angular.forEach(this.board, function(row){
rows.push(row.join(','));
Expand Down Expand Up @@ -91,7 +91,7 @@ no connection between the controller and the view.
</div>
</doc:source>
<doc:scenario>
it('should play a game', function(){
it('should play a game', function() {
piece(1, 1);
expect(binding('nextMove')).toEqual('O');
piece(3, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ angular.widget('@my:watch', function(expression, compileElement) {
angular.widget('my:time', function(compileElement){
compileElement.css('display', 'block');
return function(linkElement){
function update(){
function update() {
linkElement.text('Current time is: ' + new Date());
setTimeout(update, 1000);
}
Expand Down
10 changes: 5 additions & 5 deletions docs/content/guide/dev_guide.expressions.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ the `Scope:$eval()` method.
1+2={{1+2}}
</doc:source>
<doc:scenario>
it('should calculate expression in binding', function(){
it('should calculate expression in binding', function() {
expect(binding('1+2')).toEqual('3');
});
</doc:scenario>
Expand All @@ -52,7 +52,7 @@ You can try evaluating different expressions here:
<doc:example>
<doc:source>
<script>
function Cntl2(){
function Cntl2() {
this.exprs = [];
this.expr = '3*10|currency';
}
Expand All @@ -70,7 +70,7 @@ You can try evaluating different expressions here:
</div>
</doc:source>
<doc:scenario>
it('should allow user expression testing', function(){
it('should allow user expression testing', function() {
element('.expressions :button').click();
var li = using('.expressions ul').repeater('li');
expect(li.count()).toBe(1);
Expand Down Expand Up @@ -105,7 +105,7 @@ the global state (a common source of subtle bugs).
</div>
</doc:source>
<doc:scenario>
it('should calculate expression in binding', function(){
it('should calculate expression in binding', function() {
var alertText;
this.addFutureAction('set mock', function($window, $document, done) {
$window.mockWindow = {
Expand Down Expand Up @@ -183,7 +183,7 @@ Extensions: You can further extend the expression vocabulary by adding new metho
</table>
</doc:source>
<doc:scenario>
it('should filter the list', function(){
it('should filter the list', function() {
var tr = using('table.example3').repeater('tr.ng-attr-widget');
expect(tr.count()).toBe(5);
input('searchText').enter('a');
Expand Down
Loading

0 comments on commit fd822bd

Please sign in to comment.