Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit feac52d

Browse files
committed
refactor(ngAria): move test helpers inside of closure
1 parent f4f571e commit feac52d

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

test/ngAria/ariaSpec.js

+25-25
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@ describe('$aria', function() {
99
dealoc(element);
1010
});
1111

12-
function injectScopeAndCompiler() {
13-
return inject(function(_$compile_, _$rootScope_) {
14-
$compile = _$compile_;
15-
scope = _$rootScope_;
16-
});
17-
}
18-
19-
function compileElement(inputHtml) {
20-
element = $compile(inputHtml)(scope);
21-
scope.$digest();
22-
}
23-
2412
describe('aria-hidden', function() {
2513
beforeEach(injectScopeAndCompiler);
2614

@@ -895,19 +883,31 @@ describe('$aria', function() {
895883
expect(element.attr('tabindex')).toBe('0');
896884
});
897885
});
898-
});
899886

900-
function expectAriaAttrOnEachElement(elem, ariaAttr, expected) {
901-
angular.forEach(elem, function(val) {
902-
expect(angular.element(val).attr(ariaAttr)).toBe(expected);
903-
});
904-
}
887+
// Helpers
888+
function compileElement(inputHtml) {
889+
element = $compile(inputHtml)(scope);
890+
scope.$digest();
891+
}
892+
893+
function configAriaProvider(config) {
894+
return function() {
895+
module(function($ariaProvider) {
896+
$ariaProvider.config(config);
897+
});
898+
};
899+
}
905900

906-
function configAriaProvider(config) {
907-
return function() {
908-
angular.module('ariaTest', ['ngAria']).config(function($ariaProvider) {
909-
$ariaProvider.config(config);
901+
function expectAriaAttrOnEachElement(elem, ariaAttr, expected) {
902+
angular.forEach(elem, function(val) {
903+
expect(angular.element(val).attr(ariaAttr)).toBe(expected);
910904
});
911-
module('ariaTest');
912-
};
913-
}
905+
}
906+
907+
function injectScopeAndCompiler() {
908+
return inject(function(_$compile_, _$rootScope_) {
909+
$compile = _$compile_;
910+
scope = _$rootScope_;
911+
});
912+
}
913+
});

0 commit comments

Comments
 (0)