Index: tests/html/document_test.dart |
diff --git a/tests/html/document_test.dart b/tests/html/document_test.dart |
index eb5d36398fe9e39928d31080a408c6db57fb2ccf..fece53edeb88ec190262a1557e2db16633a76591 100644 |
--- a/tests/html/document_test.dart |
+++ b/tests/html/document_test.dart |
@@ -13,12 +13,31 @@ main() { |
var isUnknownElement = |
predicate((x) => x is UnknownElement, 'is UnknownElement'); |
+ test('CreateElement', () { |
+ // FIXME: nifty way crashes, do it boring way. |
+ expect(new Element.tag('span'), isElement); |
+ expect(new Element.tag('div'), isDivElement); |
+ expect(new Element.tag('a'), isAnchorElement); |
+ expect(new Element.tag('bad_name'), isUnknownElement); |
+ }); |
+ |
+ group('supports_cssCanvasContext', () { |
+ test('supports_cssCanvasContext', () { |
+ expect(HtmlDocument.supportsCssCanvasContext, true); |
+ }); |
+ }); |
+ |
group('getCssCanvasContext', () { |
test('getCssCanvasContext 2d', () { |
- var context = document.getCssCanvasContext('2d', 'testContext', 10, 20); |
- expect(context is CanvasRenderingContext2D, true); |
- expect(context.canvas.width, 10); |
- expect(context.canvas.height, 20); |
+ var expectation = HtmlDocument.supportsCssCanvasContext ? |
+ returnsNormally : throws; |
+ |
+ expect(() { |
+ var context = document.getCssCanvasContext('2d', 'testContext', 10, 20); |
+ expect(context is CanvasRenderingContext2D, true); |
+ expect(context.canvas.width, 10); |
+ expect(context.canvas.height, 20); |
+ }, expectation); |
}); |
}); |