test refactor

This commit is contained in:
Gerard 2018-10-22 14:36:32 +02:00
parent 409c78ec94
commit 6ef769f209
1 changed files with 6 additions and 12 deletions

View File

@ -1,19 +1,13 @@
describe('Directive bind', () => {
let $scope;
let element;
let compile;
beforeEach(() => {
angular.mock.module('client');
});
beforeEach(ngModule('client'));
compile = _element => {
inject(($compile, $rootScope, _$timeout_, _$httpBackend_) => {
$scope = $rootScope.$new();
element = angular.element(_element);
_$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
$compile(element)($scope);
$scope.$digest();
compile = html => {
inject(($compile, $rootScope) => {
let $element = $compile(html)($rootScope);
$rootScope.$digest();
$element.remove();
});
};