hterm: fix typo in blink preference handling

Commit cce97c48201b548fc98b1707d5282de4a8d468e6 (hterm: add a helper for
setting CSS variables) added a typo with the blink preference.  Fix that
and rework the code a bit to support tests.

Change-Id: I134b375f6548f9e0a838962de173827d3a43950e
Reviewed-on: https://chromium-review.googlesource.com/845479
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js
index e43739d..1629a90 100644
--- a/hterm/js/hterm_terminal.js
+++ b/hterm/js/hterm_terminal.js
@@ -390,7 +390,7 @@
     },
 
     'enable-blink': function(v) {
-      terminal.syncBlinkState();
+      terminal.setTextBlink(!!v);
     },
 
     'enable-clipboard-write': function(v) {
@@ -772,6 +772,20 @@
 };
 
 /**
+ * Get a CSS variable.
+ *
+ * Normally this is used to get variables in the hterm namespace.
+ *
+ * @param {string} name The variable to read.
+ * @param {string?} opt_prefix The variable namespace/prefix to use.
+ * @return {string} The current setting for this variable.
+ */
+hterm.Terminal.prototype.getCssVar = function(name, opt_prefix='--hterm-') {
+  return this.document_.documentElement.style.getPropertyValue(
+      `${opt_prefix}${name}`);
+};
+
+/**
  * Set the font size for this terminal.
  *
  * Call setFontSize(0) to reset to the default font size.
@@ -862,11 +876,14 @@
 };
 
 /**
- * Enable or disable blink based on the enable-blink pref.
+ * Control text blinking behavior.
+ *
+ * @param {boolean=} state Whether to enable support for blinking text.
  */
-hterm.Terminal.prototype.syncBlinkState = function() {
-  this.setCssVar('node-duration',
-                 this.prefs_.get('enable-blink') ? '0.7s' : '0');
+hterm.Terminal.prototype.setTextBlink = function(state) {
+  if (state === undefined)
+    state = this.prefs_.get('enable-blink');
+  this.setCssVar('blink-node-duration', state ? '0.7s' : '0');
 };
 
 /**