mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-10 08:25:46 +01:00
Add tests for dead help links. Fix some minor bugs. Show error when trying to modify a builtin group rather than failing silently.
This commit is contained in:
@@ -1,16 +1,8 @@
|
||||
function module(uri) {
|
||||
if (!/^[a-z-]+:/.exec(uri))
|
||||
uri = /([^ ]+\/)[^\/]+$/.exec(Components.stack.filename)[1] + uri + ".jsm";
|
||||
|
||||
let obj = {};
|
||||
Components.utils.import(uri, obj);
|
||||
return obj;
|
||||
}
|
||||
var utils = {}; Components.utils.import(/([^ ]+\/)[^\/]+$/.exec(Components.stack.filename)[1] + "utils.jsm", utils);
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Controller"];
|
||||
|
||||
var utils = module("utils");
|
||||
const { NS } = utils;
|
||||
const { module, NS } = utils;
|
||||
|
||||
var elementslib = module("resource://mozmill/modules/elementslib.js");
|
||||
var frame = module("resource://mozmill/modules/frame.js");
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
const { module } = require("utils");
|
||||
const utils = require("utils");
|
||||
const { module } = utils;
|
||||
|
||||
var jumlib = module("resource://mozmill/modules/jum.js");
|
||||
var dactyllib = module("dactyl");
|
||||
|
||||
const { Services } = module("resource://gre/modules/Services.jsm");
|
||||
|
||||
var setupModule = function (module) {
|
||||
controller = mozmill.getBrowserController();
|
||||
dactyl = new dactyllib.Controller(controller);
|
||||
@@ -15,8 +19,15 @@ var setupTest = function (test) {
|
||||
dactyl.runViCommand([["VK_ESCAPE"]]);
|
||||
};
|
||||
|
||||
function urlTarget(url) Services.io.newChannel(url, null, null).name;
|
||||
|
||||
__defineGetter__("doesNotExist", function () {
|
||||
delete this.doesNotExist;
|
||||
return this.doesNotExist = urlTarget("dactyl://help-tag/non-existent-help-tag-url-thingy");
|
||||
});
|
||||
|
||||
const HELP_FILES = ["all", "tutorial", "intro", "starting", "browsing",
|
||||
"buffer", "cmdline", "insert", "options", "pattern", "tabs", "hints",
|
||||
"buffer", "cmdline", "editing", "options", "pattern", "tabs", "hints",
|
||||
"map", "eval", "marks", "repeat", "autocommands", "print", "gui",
|
||||
"styling", "message", "privacy", "developer", "various", "plugins", "faq",
|
||||
"versions", "index"];
|
||||
@@ -56,6 +67,14 @@ var testExHelpCommand_PageTagArg_OpensHelpPageContainingTag = function () {
|
||||
HELP_COMMAND: function () { dactyl.runExCommand("help " + tag); },
|
||||
EXPECTED_HELP_TAG: tag
|
||||
});
|
||||
|
||||
let links = controller.tabs.activeTab.querySelectorAll("a[href^='dactyl:']");
|
||||
|
||||
let missing = Array.filter(links, function (link) urlTarget(link.href) === doesNotExist)
|
||||
.map(function (link) link.textContent + " -> " + link.href);
|
||||
|
||||
utils.assertEqual("testHelpCommands.assertNoDeadLinks", 0, missing.length,
|
||||
"Found dead links in " + tag + ": " + missing.join(", "));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ const Ci = Components.interfaces;
|
||||
|
||||
function module(uri) {
|
||||
if (!/^[a-z-]+:/.exec(uri))
|
||||
uri = /([^ ]+\/)[^\/]+$/.exec(Components.stack.filename)[1] + uri + ".jsm";
|
||||
uri = /([^ ]+\/)[^\/]+$/.exec(Components.stack.caller.filename)[1] + uri + ".jsm";
|
||||
|
||||
let obj = {};
|
||||
Components.utils.import(uri, obj);
|
||||
|
||||
Reference in New Issue
Block a user