OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library validator_test; | 5 library validator_test; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:svg' as svg; | 8 import 'dart:svg' as svg; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 import 'package:unittest/html_individual_config.dart'; | 10 import 'package:unittest/html_individual_config.dart'; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 reference = html; | 46 reference = html; |
47 } | 47 } |
48 | 48 |
49 validateHtml(html, reference, validator); | 49 validateHtml(html, reference, validator); |
50 }); | 50 }); |
51 } | 51 } |
52 | 52 |
53 main() { | 53 main() { |
54 useHtmlIndividualConfiguration(); | 54 useHtmlIndividualConfiguration(); |
55 | 55 |
56 group('DOM sanitization', () { | 56 group('DOM_sanitization', () { |
57 var validator = new NodeValidatorBuilder.common(); | 57 var validator = new NodeValidatorBuilder.common(); |
58 | 58 |
59 testHtml('allows simple constructs', | 59 testHtml('allows simple constructs', |
60 validator, | 60 validator, |
61 '<div class="baz">something</div>'); | 61 '<div class="baz">something</div>'); |
62 | 62 |
63 testHtml('blocks unknown attributes', | 63 testHtml('blocks unknown attributes', |
64 validator, | 64 validator, |
65 '<div foo="baz">something</div>', | 65 '<div foo="baz">something</div>', |
66 '<div>something</div>'); | 66 '<div>something</div>'); |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 validator, | 506 validator, |
507 "<form onmouseover='alert(2)'><input name='tagName'>", | 507 "<form onmouseover='alert(2)'><input name='tagName'>", |
508 ""); | 508 ""); |
509 | 509 |
510 testHtml('tagName without mouseover', | 510 testHtml('tagName without mouseover', |
511 validator, | 511 validator, |
512 "<form><input name='tagName'>", | 512 "<form><input name='tagName'>", |
513 ""); | 513 ""); |
514 }); | 514 }); |
515 } | 515 } |
OLD | NEW |