mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 21:48:00 +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,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(", "));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user