O'Reilly logo

Dart 1 for Everyone by Chris Strom

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2 + 2 = 5 Should Be Red

Client-side Dart code must be tested in a running Dart-enabled browser or headless context. A simple web page is required to host the test output. Any old HTML will suffice as long as it does the following:

  • Pulls in the Dart tests

  • Starts the Dart engine

The dummy test page for testing the HipsterCollection class will be as follows:

testing/test/01.html
 
<html>
 
<head>
 
<title>​Hipster Test Suite​</title>
 
<script​ type=​"application/dart"
 
src=​"HipsterCollectionTest.dart"​​>​​</script>
 
<script​ type=​"text/javascript"​​>
 
navigator.webkitStartDart(); // start Dart
 
</script>
 
</head>
 
 
<body>
 
<h1>​Test!​</h1>
 
</body>
 
</html>

We rely on HipsterCollectionTest.dart to import two required ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required