Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: third_party/pkg/angular/test/directive/ng_bind_html_spec.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library ng_bind_html_spec; 1 library ng_bind_html_spec;
2 2
3 import 'dart:html' as dom; 3 import 'dart:html' as dom;
4 import '../_specs.dart'; 4 import '../_specs.dart';
5 5
6 main() { 6 main() {
7 describe('BindHtmlDirective', () { 7 describe('BindHtmlDirective', () {
8 8
9 it('should sanitize and set innerHtml and sanitize and set html', 9 it('should sanitize and set innerHtml and sanitize and set html',
10 inject((Scope scope, Injector injector, Compiler compiler, DirectiveMa p directives) { 10 (Scope scope, Injector injector, Compiler compiler, DirectiveMap direc tives) {
11 var element = $('<div ng-bind-html="htmlVar"></div>'); 11 var element = es('<div ng-bind-html="htmlVar"></div>');
12 compiler(element, directives)(injector, element); 12 compiler(element, directives)(injector, element);
13 scope.context['htmlVar'] = '<a href="http://www.google.com"><b>Google!</b> </a>'; 13 scope.context['htmlVar'] = '<a href="http://www.google.com"><b>Google!</b> </a>';
14 scope.apply(); 14 scope.apply();
15 // Sanitization removes the href attribute on the <a> tag. 15 // Sanitization removes the href attribute on the <a> tag.
16 expect(element.html()).toEqual('<a><b>Google!</b></a>'); 16 expect(element).toHaveHtml('<a><b>Google!</b></a>');
17 })); 17 });
18 18
19 it('should use injected NodeValidator and override default sanitize behavior ', 19 describe('injected NodeValidator', () {
20 module((Module module) { 20 beforeEachModule((Module module) {
21 module.factory(dom.NodeValidator, (_) { 21 module.factory(dom.NodeValidator, (_) {
22 final validator = new NodeValidatorBuilder(); 22 final validator = new NodeValidatorBuilder();
23 validator.allowNavigation(new AnyUriPolicy()); 23 validator.allowNavigation(new AnyUriPolicy());
24 validator.allowTextElements(); 24 validator.allowTextElements();
25 return validator; 25 return validator;
26 });
26 }); 27 });
27 28
28 inject((Scope scope, Injector injector, Compiler compiler, DirectiveMap di rectives) { 29 it('should use injected NodeValidator and override default sanitize behavi or', (Scope scope, Injector injector, Compiler compiler, DirectiveMap directives ) {
29 var element = $('<div ng-bind-html="htmlVar"></div>'); 30 var element = es('<div ng-bind-html="htmlVar"></div>');
30 compiler(element, directives)(injector, element); 31 compiler(element, directives)(injector, element);
31 scope.context['htmlVar'] = '<a href="http://www.google.com"><b>Google!</ b></a>'; 32 scope.context['htmlVar'] = '<a href="http://www.google.com"><b>Google!</ b></a>';
32 scope.apply(); 33 scope.apply();
33 // Sanitation allows href attributes per injected sanitizer. 34 // Sanitation allows href attributes per injected sanitizer.
34 expect(element.html()).toEqual('<a href="http://www.google.com"><b>Googl e!</b></a>'); 35 expect(element).toHaveHtml('<a href="http://www.google.com"><b>Google!</ b></a>');
35 }); 36 });
36 })); 37 });
37 }); 38 });
38 } 39 }
39 40
40 class AnyUriPolicy implements UriPolicy { 41 class AnyUriPolicy implements UriPolicy {
41 bool allowsUri(String uri) => true; 42 bool allowsUri(String uri) => true;
42 } 43 }
OLDNEW
« no previous file with comments | « third_party/pkg/angular/test/directive/ng_base_css_spec.dart ('k') | third_party/pkg/angular/test/directive/ng_bind_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698