Allow option to run template test on individual files

Also adds some basic documentation on using the bazel test target.

Sample usage:
bazel test //polygerrit-ui/app:template_test --test_output errors \
--test_arg=gr-list-view

Change-Id: I013f4c4e8411b6f34afb31e9baae3bb30dea5ad4
diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md
index 01f61d9..5aa918c 100644
--- a/polygerrit-ui/README.md
+++ b/polygerrit-ui/README.md
@@ -161,4 +161,25 @@
 ```sh
 bazel test //polygerrit-ui/app:polylint_test
 ```
+## Template Type Safety
+Polymer elements are not type checked against the element definition, making it trivial to break the display when refactoring or moving code. We now run additional tests to help ensure that template types are checked.
 
+A few notes to ensure that these tests pass
+- Any functions with optional parameters will need closure annotations.
+- Any Polymer parameters that are nullable or can be multiple types (other than the one explicitly delared) will need type annotations.
+
+A few dependencies are necessary to run these tests:
+``` sh
+npm install -g typescript fried-twinkie
+```
+
+To run on all files, execute the following command:
+
+```sh
+bazel test //polygerrit-ui/app:template_test
+```
+
+To run on a specific file (ex: gr-list-view), execute the following command:
+```sh
+bazel test //polygerrit-ui/app:template_test --test_arg=gr-list-view
+```
\ No newline at end of file
diff --git a/polygerrit-ui/app/template_test.sh b/polygerrit-ui/app/template_test.sh
index a486b7f..0ed6d94 100755
--- a/polygerrit-ui/app/template_test.sh
+++ b/polygerrit-ui/app/template_test.sh
@@ -34,4 +34,5 @@
 
 unzip -o polygerrit-ui/polygerrit_components.bower_components.zip -d polygerrit-ui/app
 python $TEST_SRCDIR/gerrit/polygerrit-ui/app/template_test_srcs/convert_for_template_tests.py
-${node_bin} $TEST_SRCDIR/gerrit/polygerrit-ui/app/template_test_srcs/template_test.js
+# Pass a file name argument from the --test_args (example: --test_arg=gr-list-view)
+${node_bin} $TEST_SRCDIR/gerrit/polygerrit-ui/app/template_test_srcs/template_test.js $1
diff --git a/polygerrit-ui/app/template_test_srcs/template_test.js b/polygerrit-ui/app/template_test_srcs/template_test.js
index ef89e65..e5dae8b 100644
--- a/polygerrit-ui/app/template_test_srcs/template_test.js
+++ b/polygerrit-ui/app/template_test_srcs/template_test.js
@@ -42,9 +42,21 @@
     });
   }
 
-  const mappings = JSON.parse(fs.readFileSync(
+  let mappings = JSON.parse(fs.readFileSync(
       `./polygerrit-ui/temp/map.json`, 'utf-8'));
 
+  // If a particular file was passed by the user, don't test everything.
+  const file = process.argv[2];
+  if (file) {
+    const mappingSpecificFile = {};
+    for (key of Object.keys(mappings)) {
+      if (key.includes(file)) {
+        mappingSpecificFile[key] = mappings[key];
+      }
+    }
+    mappings = mappingSpecificFile;
+  }
+
   externs.push({
     path: 'custom-externs.js',
     src: '/** @externs */' +