Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5867)

Unified Diff: chrome/browser/resources/chromeos/chromevox/testing/common.js

Issue 586103004: Implement ChromeVox next/previous line, link, and heading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Address comments. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/testing/common.js
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/common.js b/chrome/browser/resources/chromeos/chromevox/testing/common.js
new file mode 100644
index 0000000000000000000000000000000000000000..38f2d59ff674da4761501a6e2ea16f2c24bd16da
--- /dev/null
+++ b/chrome/browser/resources/chromeos/chromevox/testing/common.js
@@ -0,0 +1,37 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Common testing utilities.
+
+/**
+ * Shortcut for document.getElementById.
+ * @param {string} id of the element.
+ * @return {HTMLElement} with the id.
+ */
+function $(id) {
+ return document.getElementById(id);
+}
+
+/**
+ * @constructor
+ */
+var TestUtils = function() {};
+
+/**
+ * Extracts some inlined html encoded as a comment inside a function,
+ * so you can use it like this:
+ *
+ * this.appendDoc(function() {/*!
+ * <p>Html goes here</p>
+ * * /});
+ *
+ * @param {Function} commentEncodedHtml The html , embedded as a
+ * comment inside an anonymous function - see example, above.
+ * @return {string} The html text.
+*/
+TestUtils.extractHtmlFromCommentEncodedString = function(commentEncodedHtml) {
+ return commentEncodedHtml.toString().
+ replace(/^[^\/]+\/\*!?/, '').
+ replace(/\*\/[^\/]+$/, '');
+};
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698