Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From your comments above, it seems like maybe you need the following information (if you don't please disregard): This is a LOT of explanation I'd have to give you that will amount to a novel if I typed it all up. As such, I'm just going to link you a LOT of articles that will do a much better job than I can of explaining each piece to you.</p> <p>Angular is all about <a href="http://docs.angularjs.org/guide/di" rel="noreferrer">dependency injection</a>. Dependency injection is <em>vital</em> if you're doing any unit testing. For sake of completeness I'll assume you don't know what dependency injection is and provide a quick explanation (forgive me if you already know this): Dependency injection is designing your code such that any external dependencies can be "injected" via an argument. A dependency would be any code external to the block of code it's in. This is why in Angular you have to include $scope in your controllers, or maybe $http or $resource... because those are being <em>injected</em> into your controller. In unit testing, this allows you to mock up those objects and pass them in, so you can see test outcomes in a controlled way.</p> <p>If you're going to use some external code (Google Maps API, Facebook API, etc) in your controller, you want to <em>inject</em> that code by wrapping it in a <a href="http://docs.angularjs.org/guide/dev_guide.services.creating_services" rel="noreferrer">service</a> and <a href="http://docs.angularjs.org/guide/dev_guide.services.injecting_controllers" rel="noreferrer">injecting it into your controller</a>.</p> <p>Also, you may want to <a href="http://docs.angularjs.org/guide/directive" rel="noreferrer">create a directive</a> for the actual map piece as DOM manipulation (such as what's done by new Map() in the Google Maps API) should be done in the directive. Then you'd just test the directive. For guidance on testing directives, I'd advise looking to <a href="https://github.com/angular/angular.js/tree/master/test/ng/directive" rel="noreferrer">Angular's directive tests in their Github repository as examples</a>. Basically you $compile the directives, and test the outcomes of manipulating it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload