From fd822bdaf9d04e522aaa5400b673f333190abe98 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 7 Oct 2011 11:27:49 -0700 Subject: chore(formating): clean code to be function() { --- docs/content/api/angular.inputType.ngdoc | 10 +++--- docs/content/cookbook/advancedform.ngdoc | 10 +++--- docs/content/cookbook/deeplinking.ngdoc | 8 ++--- docs/content/cookbook/form.ngdoc | 12 +++---- docs/content/cookbook/helloworld.ngdoc | 4 +-- docs/content/cookbook/mvc.ngdoc | 8 ++--- ...v_guide.compiler.widgets.creating_widgets.ngdoc | 2 +- docs/content/guide/dev_guide.expressions.ngdoc | 10 +++--- docs/content/guide/dev_guide.forms.ngdoc | 40 +++++++++++----------- .../dev_guide.mvc.understanding_controller.ngdoc | 6 ++-- docs/content/guide/dev_guide.overview.ngdoc | 4 +-- .../dev_guide.services.creating_services.ngdoc | 2 +- .../dev_guide.services.injecting_controllers.ngdoc | 2 +- ..._guide.templates.filters.creating_filters.ngdoc | 4 +-- docs/content/guide/dev_guide.unit-testing.ngdoc | 28 +++++++-------- docs/content/tutorial/step_02.ngdoc | 4 +-- docs/content/tutorial/step_04.ngdoc | 2 +- docs/content/tutorial/step_11.ngdoc | 2 +- 18 files changed, 79 insertions(+), 79 deletions(-) (limited to 'docs/content') diff --git a/docs/content/api/angular.inputType.ngdoc b/docs/content/api/angular.inputType.ngdoc index 434fe6c2..12c59989 100644 --- a/docs/content/api/angular.inputType.ngdoc +++ b/docs/content/api/angular.inputType.ngdoc @@ -40,8 +40,8 @@ All `inputType` widgets support: @@ -17,7 +17,7 @@ - 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'); diff --git a/docs/content/cookbook/mvc.ngdoc b/docs/content/cookbook/mvc.ngdoc index 4529cd29..a9ab7f3c 100644 --- a/docs/content/cookbook/mvc.ngdoc +++ b/docs/content/cookbook/mvc.ngdoc @@ -36,7 +36,7 @@ no connection between the controller and the view. this.setUrl(); } }, - reset: function(){ + reset: function() { this.board = [ ['', '', ''], ['', '', ''], @@ -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) || @@ -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(',')); @@ -91,7 +91,7 @@ no connection between the controller and the view. - it('should play a game', function(){ + it('should play a game', function() { piece(1, 1); expect(binding('nextMove')).toEqual('O'); piece(3, 1); diff --git a/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc b/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc index 674f98aa..b73304c0 100644 --- a/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc +++ b/docs/content/guide/dev_guide.compiler.widgets.creating_widgets.ngdoc @@ -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); } diff --git a/docs/content/guide/dev_guide.expressions.ngdoc b/docs/content/guide/dev_guide.expressions.ngdoc index ab5a897b..57fb9130 100644 --- a/docs/content/guide/dev_guide.expressions.ngdoc +++ b/docs/content/guide/dev_guide.expressions.ngdoc @@ -41,7 +41,7 @@ the `Scope:$eval()` method. 1+2={{1+2}} - it('should calculate expression in binding', function(){ + it('should calculate expression in binding', function() { expect(binding('1+2')).toEqual('3'); }); @@ -52,7 +52,7 @@ You can try evaluating different expressions here: @@ -50,7 +50,7 @@ text upper-case and assigns color. - it('should reverse greeting', function(){ + it('should reverse greeting', function() { expect(binding('greeting|reverse')).toEqual('olleh'); input('greeting').enter('ABC'); expect(binding('greeting|reverse')).toEqual('CBA'); diff --git a/docs/content/guide/dev_guide.unit-testing.ngdoc b/docs/content/guide/dev_guide.unit-testing.ngdoc index 459b6b93..978784f9 100644 --- a/docs/content/guide/dev_guide.unit-testing.ngdoc +++ b/docs/content/guide/dev_guide.unit-testing.ngdoc @@ -43,11 +43,11 @@ on a constructor permanently binds the call site to the type. For example lets s trying to instantiate an `XHR` so that we can get some data from the server.
-function MyClass(){
-  this.doWork = function(){
+function MyClass() {
+  this.doWork = function() {
     var xhr = new XHR();
     xhr.open(method, url, true);
-    xhr.onreadystatechange = function(){...}
+    xhr.onreadystatechange = function() {...}
     xhr.send();
   }
 }
@@ -61,7 +61,7 @@ patching, that is a bad idea for many reasons, which is outside the scope of thi
 The class above is hard to test since we have to resort to monkey patching:
 
 var oldXHR = XHR;
-XHR = function MockXHR(){};
+XHR = function MockXHR() {};
 var myClass = new MyClass();
 myClass.doWork();
 // assert that MockXHR got called with the right arguments
@@ -73,8 +73,8 @@ XHR = oldXHR; // if you forget this bad things will happen
 Another way to approach the problem is look for the service in a well known location.
 
 
-function MyClass(){
-  this.doWork = function(){
+function MyClass() {
+  this.doWork = function() {
     global.xhr({
       method:'...',
       url:'...',
@@ -94,7 +94,7 @@ State & Singletons}
 The class above is hard to test since we have to change global state:
 
 var oldXHR = glabal.xhr;
-glabal.xhr = function mockXHR(){};
+glabal.xhr = function mockXHR() {};
 var myClass = new MyClass();
 myClass.doWork();
 // assert that mockXHR got called with the right arguments
@@ -110,7 +110,7 @@ having the tests replace the services as needed.
 
 function MyClass() {
   var serviceRegistry = ????;
-  this.doWork = function(){
+  this.doWork = function() {
     var xhr = serviceRegistry.get('xhr');
     xhr({
       method:'...',
@@ -128,7 +128,7 @@ there is only one global variable to be reset).
 The class above is hard to test since we have to change global state:
 
 var oldServiceLocator = glabal.serviceLocator;
-glabal.serviceLocator.set('xhr', function mockXHR(){});
+glabal.serviceLocator.set('xhr', function mockXHR() {});
 var myClass = new MyClass();
 myClass.doWork();
 // assert that mockXHR got called with the right arguments
@@ -141,7 +141,7 @@ Lastly the dependency can be passed in.
 
 
 function MyClass(xhr) {
-  this.doWork = function(){
+  this.doWork = function() {
     xhr({
       method:'...',
       url:'...',
@@ -174,13 +174,13 @@ for your application is mixed in with DOM manipulation, it will be hard to test
 below:
 
 
-function PasswordController(){
+function PasswordController() {
   // get references to DOM elements
   var msg = $('.ex1 span');
   var input = $('.ex1 input');
   var strength;
 
-  this.grade = function(){
+  this.grade = function() {
     msg.removeClass(strength);
     var pwd = input.val();
     password.text(pwd);
@@ -219,9 +219,9 @@ In angular the controllers are strictly separated from the DOM manipulation logi
 a much easier testability story as can be seen in this example:
 
 
-function PasswordCntrl(){
+function PasswordCntrl() {
   this.password = '';
-  this.grade = function(){
+  this.grade = function() {
     var size = this.password.length;
     if (size > 8) {
       this.strength = 'strong';
diff --git a/docs/content/tutorial/step_02.ngdoc b/docs/content/tutorial/step_02.ngdoc
index 4e1abfad..09065979 100644
--- a/docs/content/tutorial/step_02.ngdoc
+++ b/docs/content/tutorial/step_02.ngdoc
@@ -69,7 +69,7 @@ view.
 ## Model and Controller
 
 The data __model__ (a simple array  of phones in object literal notation) is instantiated within
-the __controller__ function (`PhoneListCtrl`):
+the __controller__ function(`PhoneListCtrl`):
 
 __`app/js/controllers.js`:__
 
@@ -91,7 +91,7 @@ providing context for our data model, the controller allows us to establish data
 the model and the view. We connected the dots between the presentation, data, and logic components
 as follows:
 
-* The name of our controller function (in the JavaScript file `controllers.js`) matches the {@link
+* The name of our controller function(in the JavaScript file `controllers.js`) matches the {@link
 api/angular.directive.ng:controller ng:controller} directive in the `` tag (`PhoneListCtrl`).
 * The data is instantiated within the *scope* of our controller function; our template binding
 points are located within the block bounded by the `` tag.
diff --git a/docs/content/tutorial/step_04.ngdoc b/docs/content/tutorial/step_04.ngdoc
index d05a8e7c..6426674a 100644
--- a/docs/content/tutorial/step_04.ngdoc
+++ b/docs/content/tutorial/step_04.ngdoc
@@ -114,7 +114,7 @@ __`test/unit/controllerSpec.js`:__
 
 describe('PhoneCat controllers', function() {
 
-  describe('PhoneListCtrl', function(){
+  describe('PhoneListCtrl', function() {
     var scope, $browser, ctrl;
 
     beforeEach(function() {
diff --git a/docs/content/tutorial/step_11.ngdoc b/docs/content/tutorial/step_11.ngdoc
index 3d474583..450bf679 100644
--- a/docs/content/tutorial/step_11.ngdoc
+++ b/docs/content/tutorial/step_11.ngdoc
@@ -129,7 +129,7 @@ __`test/unit/controllersSpec.js`:__
 
 describe('PhoneCat controllers', function() {
 
-  beforeEach(function(){
+  beforeEach(function() {
     this.addMatchers({
       toEqualData: function(expected) {
         return angular.equals(this.actual, expected);
-- 
cgit v1.2.3