-
Book Overview & Buying
-
Table Of Contents
DART Cookbook
By :
A project should contain a number of automated tests that can be run after every code change to ensure that the previous functionality still works. Dart's unittest framework is the best tool for the job, and the Dart website has some excellent articles to get you started. However, testing Polymer web applications is a lot trickier because of the way Polymer works, as it hides HTML in shadow DOM and also because it works in an asynchronous fashion, independent of the testing code.
We will create some tests in the ClickCounter example (the standard web application template using the polymer library). You can find the code in the polymer1 app. We include the unittest library in the pubspec.yaml file, and create a test folder.
In the test folder, we create a test_polymer1.html page; a web page that loads the Polymer component required to test this functionality. The following is the minimum content required for the component:
<head>...
Change the font size
Change margin width
Change background colour