diff options
| author | Vojta Jina | 2012-04-10 16:50:31 -0700 | 
|---|---|---|
| committer | Vojta Jina | 2012-04-11 15:50:47 -0700 | 
| commit | 5bcd7198664dca2bf85ddf8b3a89f417cd4e4796 (patch) | |
| tree | 3c9bde1e97e94a4af986019dbaea1eaa50a209d9 /test/ngSanitize/directive | |
| parent | e1743cc837a51e3146f2e73e3083eee7f4a8f549 (diff) | |
| download | angular.js-5bcd7198664dca2bf85ddf8b3a89f417cd4e4796.tar.bz2 | |
chore(ngSanitize): extract $sanitize, ngBindHtml, linkyFilter into a module
Create build for other modules as well (ngResource, ngCookies):
- wrap into a function
- add license
- add version
Breaks `$sanitize` service, `ngBindHtml` directive and `linky` filter were moved to the `ngSanitize` module. Apps that depend on any of these will need to load `angular-sanitize.js` and include `ngSanitize` in their dependency list: `var myApp = angular.module('myApp', ['ngSanitize']);`
Diffstat (limited to 'test/ngSanitize/directive')
| -rw-r--r-- | test/ngSanitize/directive/ngBindHtmlSpec.js | 25 | 
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ngSanitize/directive/ngBindHtmlSpec.js b/test/ngSanitize/directive/ngBindHtmlSpec.js new file mode 100644 index 00000000..be23e5a5 --- /dev/null +++ b/test/ngSanitize/directive/ngBindHtmlSpec.js @@ -0,0 +1,25 @@ +describe('ngBindHtml', function() { +  beforeEach(module('ngSanitize')); + +  it('should set html', inject(function($rootScope, $compile) { +    element = $compile('<div ng-bind-html="html"></div>')($rootScope); +    $rootScope.html = '<div unknown>hello</div>'; +    $rootScope.$digest(); +    expect(angular.lowercase(element.html())).toEqual('<div>hello</div>'); +  })); + + +  it('should reset html when value is null or undefined', inject(function($compile, $rootScope) { +    element = $compile('<div ng-bind-html="html"></div>')($rootScope); + +    angular.forEach([null, undefined, ''], function(val) { +      $rootScope.html = 'some val'; +      $rootScope.$digest(); +      expect(angular.lowercase(element.html())).toEqual('some val'); + +      $rootScope.html = val; +      $rootScope.$digest(); +      expect(angular.lowercase(element.html())).toEqual(''); +    }); +  })); +});  | 
