Skip to content

Commit db4955a

Browse files
test($compile): add tests for provider settings
See angular#15095 (comment)
1 parent a779977 commit db4955a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

test/ng/compileSpec.js

+54
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,60 @@ describe('$compile', function() {
151151

152152
describe('configuration', function() {
153153

154+
it('should allow aHrefSanitizationWhitelist to be configured', function() {
155+
module(function($compileProvider) {
156+
expect($compileProvider.aHrefSanitizationWhitelist()).toEqual(/^\s*(https?|ftp|mailto|tel|file):/); // the default
157+
$compileProvider.aHrefSanitizationWhitelist(/other/);
158+
expect($compileProvider.aHrefSanitizationWhitelist()).toEqual(/other/);
159+
});
160+
inject();
161+
});
162+
163+
it('should allow debugInfoEnabled to be configured', function() {
164+
module(function($compileProvider) {
165+
expect($compileProvider.debugInfoEnabled()).toBe(true); // the default
166+
$compileProvider.debugInfoEnabled(false);
167+
expect($compileProvider.debugInfoEnabled()).toBe(false);
168+
});
169+
inject();
170+
});
171+
172+
it('should allow preAssignBindingsEnabled to be configured', function() {
173+
module(function($compileProvider) {
174+
expect($compileProvider.preAssignBindingsEnabled()).toBe(true); // the default
175+
$compileProvider.preAssignBindingsEnabled(false);
176+
expect($compileProvider.preAssignBindingsEnabled()).toBe(false);
177+
});
178+
inject();
179+
});
180+
181+
it('should allow onChangesTtl to be configured', function() {
182+
module(function($compileProvider) {
183+
expect($compileProvider.onChangesTtl()).toBe(10); // the default
184+
$compileProvider.onChangesTtl(2);
185+
expect($compileProvider.onChangesTtl()).toBe(2);
186+
});
187+
inject();
188+
});
189+
190+
it('should allow commentDirectivesEnabled to be configured', function() {
191+
module(function($compileProvider) {
192+
expect($compileProvider.commentDirectivesEnabled()).toBe(true); // the default
193+
$compileProvider.commentDirectivesEnabled(false);
194+
expect($compileProvider.commentDirectivesEnabled()).toBe(false);
195+
});
196+
inject();
197+
});
198+
199+
it('should allow cssClassDirectivesEnabled to be configured', function() {
200+
module(function($compileProvider) {
201+
expect($compileProvider.cssClassDirectivesEnabled()).toBe(true); // the default
202+
$compileProvider.cssClassDirectivesEnabled(false);
203+
expect($compileProvider.cssClassDirectivesEnabled()).toBe(false);
204+
});
205+
inject();
206+
});
207+
154208
it('should register a directive', function() {
155209
module(function() {
156210
directive('div', function(log) {

0 commit comments

Comments
 (0)