OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'dart:html'; | 5 import 'dart:html'; |
6 | 6 |
7 import 'package:expect/minitest.dart'; | 7 import 'package:expect/minitest.dart'; |
8 | 8 |
9 main() { | 9 main() { |
10 var isShadowRoot = | 10 var isShadowRoot = predicate((x) => x is ShadowRoot, 'is a ShadowRoot'); |
11 predicate((x) => x is ShadowRoot, 'is a ShadowRoot'); | |
12 | 11 |
13 test('ShadowRoot supported', () { | 12 test('ShadowRoot supported', () { |
14 var isSupported = ShadowRoot.supported; | 13 var isSupported = ShadowRoot.supported; |
15 | 14 |
16 // If it's supported, then it should work. Otherwise should fail. | 15 // If it's supported, then it should work. Otherwise should fail. |
17 if (isSupported) { | 16 if (isSupported) { |
18 var div = new DivElement(); | 17 var div = new DivElement(); |
19 var shadowRoot = div.createShadowRoot(); | 18 var shadowRoot = div.createShadowRoot(); |
20 expect(shadowRoot, isShadowRoot); | 19 expect(shadowRoot, isShadowRoot); |
21 expect(div.shadowRoot, shadowRoot); | 20 expect(div.shadowRoot, shadowRoot); |
22 } else { | 21 } else { |
23 expect(() => new DivElement().createShadowRoot(), throws); | 22 expect(() => new DivElement().createShadowRoot(), throws); |
24 } | 23 } |
25 }); | 24 }); |
26 } | 25 } |
OLD | NEW |