test($compile): add tests for provider settings

See https://github.com/angular/angular.js/pull/15095#issuecomment-244970426
This commit is contained in:
Peter Bacon Darwin
2016-09-07 08:42:19 +01:00
parent dfb8cf6402
commit 3cb5bad15d
+54
View File
@@ -151,6 +151,60 @@ describe('$compile', function() {
describe('configuration', function() {
it('should allow aHrefSanitizationWhitelist to be configured', function() {
module(function($compileProvider) {
expect($compileProvider.aHrefSanitizationWhitelist()).toEqual(/^\s*(https?|ftp|mailto|tel|file):/); // the default
$compileProvider.aHrefSanitizationWhitelist(/other/);
expect($compileProvider.aHrefSanitizationWhitelist()).toEqual(/other/);
});
inject();
});
it('should allow debugInfoEnabled to be configured', function() {
module(function($compileProvider) {
expect($compileProvider.debugInfoEnabled()).toBe(true); // the default
$compileProvider.debugInfoEnabled(false);
expect($compileProvider.debugInfoEnabled()).toBe(false);
});
inject();
});
it('should allow preAssignBindingsEnabled to be configured', function() {
module(function($compileProvider) {
expect($compileProvider.preAssignBindingsEnabled()).toBe(true); // the default
$compileProvider.preAssignBindingsEnabled(false);
expect($compileProvider.preAssignBindingsEnabled()).toBe(false);
});
inject();
});
it('should allow onChangesTtl to be configured', function() {
module(function($compileProvider) {
expect($compileProvider.onChangesTtl()).toBe(10); // the default
$compileProvider.onChangesTtl(2);
expect($compileProvider.onChangesTtl()).toBe(2);
});
inject();
});
it('should allow commentDirectivesEnabled to be configured', function() {
module(function($compileProvider) {
expect($compileProvider.commentDirectivesEnabled()).toBe(true); // the default
$compileProvider.commentDirectivesEnabled(false);
expect($compileProvider.commentDirectivesEnabled()).toBe(false);
});
inject();
});
it('should allow cssClassDirectivesEnabled to be configured', function() {
module(function($compileProvider) {
expect($compileProvider.cssClassDirectivesEnabled()).toBe(true); // the default
$compileProvider.cssClassDirectivesEnabled(false);
expect($compileProvider.cssClassDirectivesEnabled()).toBe(false);
});
inject();
});
it('should register a directive', function() {
module(function() {
directive('div', function(log) {