0
我正在基于此blog创建Facebook登录指令。测试angularj Facebook登录指令
app.directive('facebook', function($http) {
return {
restrict: 'A',
scope: true,
controller: function($scope, $attrs, $location) {
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
// ... the rest of the directive
我该如何测试这个匿名函数?嘲笑文件似乎并不奏效。
我不想在单元测试中击中Facebook。此外,这个课程的其余部分需要测试。 – zhon