XKE 2013.10.22 Directives unit-testing

by Mike Kotsur

HTML

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular.js"></script>
<script src="http://cdn.jsdelivr.net/jasmine/1.3.1/jasmine.js"></script>
<script src="http://cdn.jsdelivr.net/jasmine/1.3.1/jasmine-html.js"></script>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/jasmine/1.3.1/jasmine.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular-mocks.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>

CoffeeScript

demo = angular.module 'demo', []

# put 2 directives here

####################################################
describe "calculator", ->
  
  beforeEach -> angular.mock.module 'demo'
    
  it "should just work", inject ($compile, $rootScope) ->
    expect(2 * 2).toBe 5


####### load jasmine htmlReporter ###################
l = ->
  env = jasmine.getEnv();
  env.addReporter(new jasmine.HtmlReporter());
  env.execute();
l()