0
嘗試使用generator-cg-angular。測試我的指令我得到「錯誤:意外的請求:GET生態系統/工作/指令/ configKey/configKey.html」我可以使用html2js修復,但根據cgross我不應該需要。他說我只是沒有正確配置httpBackend來傳遞模板請求。無法弄清楚我做錯了什麼。意外請求:GET使用grunt-angular-templates
此處瞭解詳情: https://github.com/cgross/generator-cg-angular/issues/78
代碼:
describe('Directive: configKey', function() {
beforeEach(module('app'));
var scope, ctrl, new_key;
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('ConfigKeyCtrl', {
$scope:scope
});
new_key = { edit:true };
scope.data = angular.copy(data);
}));
it('should highlight added keys', function() {
scope.key.change = 'add';
scope.saveKey();
scope.$digest();
expect(elem.hasClass('alert-success')).toBe(true);
});
});