OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 DocumentFragmentTest; | 5 library DocumentFragmentTest; |
6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
7 import '../../pkg/unittest/lib/html_config.dart'; | 7 import '../../pkg/unittest/lib/html_config.dart'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 part 'util.dart'; | 9 part 'util.dart'; |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 } | 37 } |
38 expect(true, isFalse, reason: 'Expected immutability error'); | 38 expect(true, isFalse, reason: 'Expected immutability error'); |
39 }; | 39 }; |
40 | 40 |
41 void expectEmptyStyleDeclaration(CSSStyleDeclaration style) { | 41 void expectEmptyStyleDeclaration(CSSStyleDeclaration style) { |
42 expect(style.cssText, equals('')); | 42 expect(style.cssText, equals('')); |
43 expect(style.getPropertyPriority('color'), equals('')); | 43 expect(style.getPropertyPriority('color'), equals('')); |
44 expect(style.item(0), equals('')); | 44 expect(style.item(0), equals('')); |
45 expect(style.length, isZero); | 45 expect(style.length, isZero); |
46 // TODO(jacobr): these checks throw NotImplementedExceptions in dartium. | 46 // TODO(jacobr): these checks throw UnimplementedErrors in dartium. |
47 // expect(style.parentRule, isNull); | 47 // expect(style.parentRule, isNull); |
48 // expect(style.getPropertyCSSValue('color'), isNull); | 48 // expect(style.getPropertyCSSValue('color'), isNull); |
49 // expect(style.getPropertyShorthand('color'), isNull); | 49 // expect(style.getPropertyShorthand('color'), isNull); |
50 // expect(style.isPropertyImplicit('color'), isFalse); | 50 // expect(style.isPropertyImplicit('color'), isFalse); |
51 | 51 |
52 // Ideally these would throw errors, but it's not possible to create a class | 52 // Ideally these would throw errors, but it's not possible to create a class |
53 // that'll intercept these calls without implementing the entire | 53 // that'll intercept these calls without implementing the entire |
54 // CSSStyleDeclaration interface, so we'll settle for them being no-ops. | 54 // CSSStyleDeclaration interface, so we'll settle for them being no-ops. |
55 style.cssText = '* {color: blue}'; | 55 style.cssText = '* {color: blue}'; |
56 style.removeProperty('color'); | 56 style.removeProperty('color'); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // // assertConstError(() => fragment.classes.add('foo')); | 351 // // assertConstError(() => fragment.classes.add('foo')); |
352 // }); | 352 // }); |
353 | 353 |
354 test('query searches the fragment', () { | 354 test('query searches the fragment', () { |
355 var fragment = new DocumentFragment.html( | 355 var fragment = new DocumentFragment.html( |
356 "<div class='foo'><a>foo</a><b>bar</b></div>"); | 356 "<div class='foo'><a>foo</a><b>bar</b></div>"); |
357 expect(fragment.query(".foo a").tagName, "A"); | 357 expect(fragment.query(".foo a").tagName, "A"); |
358 expect(_nodeStrings(fragment.queryAll(".foo *")), equals(["A", "B"])); | 358 expect(_nodeStrings(fragment.queryAll(".foo *")), equals(["A", "B"])); |
359 }); | 359 }); |
360 } | 360 } |
OLD | NEW |