Created
October 28, 2013 19:16
-
-
Save bclinkinbeard/7202844 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this would actually be in a beforeEach or something | |
// just haven't done that yet | |
var angular = require('angular'); | |
var app = angular.module('app', []) | |
.directive('someDirective', require('./myDirective')); | |
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function () { | |
return function (scope, elem) { | |
elem.addClass('fizzbuzz'); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var test = require('tape'), | |
proxyquire = require('proxyquire').noCallThru(), | |
angular = require('angular-node')(), | |
app = proxyquire('./app', {'angular': angular}); | |
inject = angular.injector(['ng', 'app']).invoke; | |
test('someDirective', function (t) { | |
var el; | |
inject(function($rootScope, $compile, $document) { | |
el = angular.element('<div some-directive>{{ 7 + 5 }}</div>'); | |
el = $compile(el)($rootScope); | |
$rootScope.$digest(); | |
}) | |
t.true(el.hasClass('fizzbuzz'), 'fizzbuzz class present'); | |
t.equal(+el.html(), 12, 'YESSSS'); | |
t.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think you need the trailing
()
inrequire('angular-node')()
, this was written a long time ago, so I'm guessing things have changed since then.