Skip to content

Commit b6f3c78

Browse files
committed
refactor(ngAria): move test helpers inside of closure
1 parent 56a9eab commit b6f3c78

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

test/ngAria/ariaSpec.js

+25-26
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

@@ -84,7 +72,6 @@ describe('$aria', function() {
8472
});
8573
});
8674

87-
8875
describe('aria-hidden when disabled', function() {
8976
beforeEach(configAriaProvider({
9077
ariaHidden: false
@@ -799,19 +786,31 @@ describe('$aria', function() {
799786
expect(element.attr('tabindex')).toBeUndefined();
800787
});
801788
});
802-
});
803789

804-
function expectAriaAttrOnEachElement(elem, ariaAttr, expected) {
805-
angular.forEach(elem, function(val) {
806-
expect(angular.element(val).attr(ariaAttr)).toBe(expected);
807-
});
808-
}
790+
// Helpers
791+
function compileElement(inputHtml) {
792+
element = $compile(inputHtml)(scope);
793+
scope.$digest();
794+
}
795+
796+
function configAriaProvider(config) {
797+
return function() {
798+
module(function($ariaProvider) {
799+
$ariaProvider.config(config);
800+
});
801+
};
802+
}
809803

810-
function configAriaProvider(config) {
811-
return function() {
812-
angular.module('ariaTest', ['ngAria']).config(function($ariaProvider) {
813-
$ariaProvider.config(config);
804+
function expectAriaAttrOnEachElement(elem, ariaAttr, expected) {
805+
angular.forEach(elem, function(val) {
806+
expect(angular.element(val).attr(ariaAttr)).toBe(expected);
814807
});
815-
module('ariaTest');
816-
};
817-
}
808+
}
809+
810+
function injectScopeAndCompiler() {
811+
return inject(function(_$compile_, _$rootScope_) {
812+
$compile = _$compile_;
813+
scope = _$rootScope_;
814+
});
815+
}
816+
});

0 commit comments

Comments
 (0)