mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-05 11:23:32 +02:00
Frob tests.
This commit is contained in:
@@ -300,7 +300,7 @@ var Abbreviations = Module("abbreviations", {
|
|||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
args["-group"].clear(modes);
|
args["-group"].clear(modes);
|
||||||
else if (!args["-group"].remove(modes, lhs))
|
else if (!args["-group"].remove(modes, args[0]))
|
||||||
return dactyl.echoerr("E24: No such abbreviation");
|
return dactyl.echoerr("E24: No such abbreviation");
|
||||||
}, {
|
}, {
|
||||||
argCount: "?",
|
argCount: "?",
|
||||||
|
|||||||
@@ -1368,7 +1368,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
dactyl.echoerr(template.linkifyHelp(error.message));
|
dactyl.echoerr(template.linkifyHelp(error.message));
|
||||||
else
|
else
|
||||||
dactyl.beep();
|
dactyl.beep();
|
||||||
util.reportError(error);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (error.result == Cr.NS_BINDING_ABORTED)
|
if (error.result == Cr.NS_BINDING_ABORTED)
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ var Mappings = Module("mappings", {
|
|||||||
* {@link Map#extraInfo}).
|
* {@link Map#extraInfo}).
|
||||||
* @optional
|
* @optional
|
||||||
*/
|
*/
|
||||||
addUserMap: deprecated("groups.mappings.add", function addUserMap() {
|
addUserMap: deprecated("group.mappings.add", function addUserMap() {
|
||||||
let map = this.user.add.apply(this.user, arguments);
|
let map = this.user.add.apply(this.user, arguments);
|
||||||
map.definedAt = contexts.getCaller(Components.stack.caller);
|
map.definedAt = contexts.getCaller(Components.stack.caller);
|
||||||
return map;
|
return map;
|
||||||
@@ -387,17 +387,18 @@ var Mappings = Module("mappings", {
|
|||||||
* @param {string} filter The filter string to match.
|
* @param {string} filter The filter string to match.
|
||||||
*/
|
*/
|
||||||
list: function (modes, filter, hives) {
|
list: function (modes, filter, hives) {
|
||||||
hives = (hives || mappings.userHives).filter(function (h) modes.some(function (m) h.getStack(m).length));
|
|
||||||
|
|
||||||
let modeSign = "";
|
let modeSign = "";
|
||||||
modes.filter(function (m) m.char).forEach(function (m) { modeSign += m.char; });
|
modes.filter(function (m) m.char).forEach(function (m) { modeSign += m.char; });
|
||||||
modes.filter(function (m) !m.char).forEach(function (m) { modeSign += " " + m.name; });
|
modes.filter(function (m) !m.char).forEach(function (m) { modeSign += " " + m.name; });
|
||||||
modeSign = modeSign.replace(/^ /, "");
|
modeSign = modeSign.replace(/^ /, "");
|
||||||
|
|
||||||
|
hives = (hives || mappings.userHives).map(function (h) [h, maps(h)])
|
||||||
|
.filter(function ([h, m]) !filter || m.length);
|
||||||
|
|
||||||
function maps(hive) {
|
function maps(hive) {
|
||||||
let maps = hive.iterate(modes);
|
let maps = iter.toArray(hive.iterate(modes));
|
||||||
if (filter)
|
if (filter)
|
||||||
maps = [map for (map in maps) if (map.names[0] == filter)];
|
maps = maps.filter(function (m) m.names[0] === filter);
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,9 +411,9 @@ var Mappings = Module("mappings", {
|
|||||||
</tr>
|
</tr>
|
||||||
<col style="min-width: 6em; padding-right: 1em;"/>
|
<col style="min-width: 6em; padding-right: 1em;"/>
|
||||||
{
|
{
|
||||||
template.map(hives, function (hive) let (i = 0)
|
template.map(hives, function ([hive, maps]) let (i = 0)
|
||||||
<tr style="height: .5ex;"/> +
|
<tr style="height: .5ex;"/> +
|
||||||
template.map(maps(hive), function (map)
|
template.map(maps, function (map)
|
||||||
template.map(map.names, function (name)
|
template.map(map.names, function (name)
|
||||||
<tr>
|
<tr>
|
||||||
<td highlight="Title">{!i++ ? hive.name : ""}</td>
|
<td highlight="Title">{!i++ ? hive.name : ""}</td>
|
||||||
|
|||||||
@@ -52,9 +52,6 @@ var tests = {
|
|||||||
noOutput: ["abc def", "-js abc def"],
|
noOutput: ["abc def", "-js abc def"],
|
||||||
completions: ["", "abc ", "-js abc "]
|
completions: ["", "abc ", "-js abc "]
|
||||||
},
|
},
|
||||||
abclear: {
|
|
||||||
noOutput: [""]
|
|
||||||
},
|
|
||||||
addons: {
|
addons: {
|
||||||
multiOutput: ["", "dactyl", "-type=extension", "-type=extension dactyl"],
|
multiOutput: ["", "dactyl", "-type=extension", "-type=extension dactyl"],
|
||||||
completions: [
|
completions: [
|
||||||
@@ -118,7 +115,7 @@ var tests = {
|
|||||||
error: ["", "some-nonexistent-scheme"]
|
error: ["", "some-nonexistent-scheme"]
|
||||||
},
|
},
|
||||||
command: {
|
command: {
|
||||||
init: ["comclear"],
|
init: ["delc!"],
|
||||||
singleOutput: ["", "foobar"],
|
singleOutput: ["", "foobar"],
|
||||||
noOutput: ["foo bar", "-js bar baz"],
|
noOutput: ["foo bar", "-js bar baz"],
|
||||||
multiOutput: [""],
|
multiOutput: [""],
|
||||||
@@ -134,9 +131,6 @@ var tests = {
|
|||||||
["-group=user ", hasItems]
|
["-group=user ", hasItems]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
comclear: {
|
|
||||||
noOutput: [""]
|
|
||||||
},
|
|
||||||
contexts: {}, // Not testable in this manner
|
contexts: {}, // Not testable in this manner
|
||||||
cookies: {
|
cookies: {
|
||||||
anyOutput: ["dactyl.sf.net", "dactyl.sf.net list"],
|
anyOutput: ["dactyl.sf.net", "dactyl.sf.net list"],
|
||||||
@@ -149,13 +143,14 @@ var tests = {
|
|||||||
delbmarks: { anyOutput: ["", "about:pentadactyl"] },
|
delbmarks: { anyOutput: ["", "about:pentadactyl"] },
|
||||||
delcommand: [
|
delcommand: [
|
||||||
{
|
{
|
||||||
init: ["comclear", "command foo bar"],
|
init: ["delc!", "command foo bar"],
|
||||||
|
error: [""],
|
||||||
completions: [
|
completions: [
|
||||||
["", hasItems],
|
["", hasItems],
|
||||||
["-group=", hasItems],
|
["-group=", hasItems],
|
||||||
["-group=user ", hasItems]
|
["-group=user ", hasItems]
|
||||||
],
|
],
|
||||||
noOutput: ["foo"]
|
noOutput: ["foo", "! "]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
init: ["comclear"],
|
init: ["comclear"],
|
||||||
@@ -353,7 +348,9 @@ var tests = {
|
|||||||
completions: [""]
|
completions: [""]
|
||||||
},
|
},
|
||||||
map: {
|
map: {
|
||||||
multiOutput: ["", "i"],
|
init: ["unmap!"],
|
||||||
|
anyOutput: [""],
|
||||||
|
singleOutput: ["i"],
|
||||||
noOutput: [
|
noOutput: [
|
||||||
"i j",
|
"i j",
|
||||||
"-builtin i j",
|
"-builtin i j",
|
||||||
@@ -363,6 +360,7 @@ var tests = {
|
|||||||
"-silent i :j",
|
"-silent i :j",
|
||||||
"-mode=ex -b <C-a> <C-a>"
|
"-mode=ex -b <C-a> <C-a>"
|
||||||
],
|
],
|
||||||
|
multiOutput: ["", "i"],
|
||||||
error: [
|
error: [
|
||||||
"-mode=some-nonexistent-mode <C-a> <C-a>",
|
"-mode=some-nonexistent-mode <C-a> <C-a>",
|
||||||
"-group=some-nonexistent-group <C-a> <C-a>",
|
"-group=some-nonexistent-group <C-a> <C-a>",
|
||||||
@@ -379,16 +377,6 @@ var tests = {
|
|||||||
["-javascript i ", hasItems]
|
["-javascript i ", hasItems]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
mapclear: {
|
|
||||||
noOutput: [""],
|
|
||||||
error: [
|
|
||||||
"-group=builtin"
|
|
||||||
],
|
|
||||||
completions: [
|
|
||||||
"",
|
|
||||||
"-group="
|
|
||||||
]
|
|
||||||
},
|
|
||||||
mark: {
|
mark: {
|
||||||
error: ["", "#", "xy"],
|
error: ["", "#", "xy"],
|
||||||
noOutput: ["y"],
|
noOutput: ["y"],
|
||||||
@@ -554,7 +542,31 @@ var tests = {
|
|||||||
noOutput: [""]
|
noOutput: [""]
|
||||||
},
|
},
|
||||||
scriptnames: {},
|
scriptnames: {},
|
||||||
set: {},
|
set: {
|
||||||
|
multiOutput: [
|
||||||
|
"vb?", "cpt?", "messages?", "titlestring?", "au?", "eht?",
|
||||||
|
"cpt", "messages", "titlestring", "au", "eht"
|
||||||
|
],
|
||||||
|
noOutput: ["vb", "novb"],
|
||||||
|
completions: [
|
||||||
|
["", hasItems],
|
||||||
|
["c", hasItems],
|
||||||
|
["cpt=", hasItems],
|
||||||
|
["cpt=l", hasItems],
|
||||||
|
["cpt+=", hasItems],
|
||||||
|
["cpt+=f", hasItems],
|
||||||
|
["activate=", hasItems],
|
||||||
|
["activate=links,", hasItems],
|
||||||
|
["activate+=", hasItems],
|
||||||
|
["activate+=links,", hasItems],
|
||||||
|
["activate^=", hasItems],
|
||||||
|
["activate^=links,", hasItems],
|
||||||
|
["activate-=", hasItems],
|
||||||
|
["activate-=links,", hasItems],
|
||||||
|
["activate!=", hasItems],
|
||||||
|
["activate!=links,", hasItems]
|
||||||
|
]
|
||||||
|
},
|
||||||
get setglobal() this.set,
|
get setglobal() this.set,
|
||||||
get setlocal() this.set,
|
get setlocal() this.set,
|
||||||
sidebar: {
|
sidebar: {
|
||||||
@@ -702,12 +714,28 @@ var tests = {
|
|||||||
],
|
],
|
||||||
error: ["", "foo"]
|
error: ["", "foo"]
|
||||||
},
|
},
|
||||||
tunmap: {},
|
unabbreviate: {
|
||||||
unabbreviate: {},
|
noOutput: ["abc", "! "],
|
||||||
|
error: [""]
|
||||||
|
},
|
||||||
undo: {},
|
undo: {},
|
||||||
undoall: {},
|
undoall: {},
|
||||||
unlet: {},
|
unlet: {},
|
||||||
unmap: {},
|
unmap: {
|
||||||
|
noOutput: [
|
||||||
|
"i",
|
||||||
|
"! "
|
||||||
|
],
|
||||||
|
error: [
|
||||||
|
"i",
|
||||||
|
"-group=builtin k",
|
||||||
|
"! -group=builtin"
|
||||||
|
],
|
||||||
|
completions: [
|
||||||
|
"",
|
||||||
|
"-group="
|
||||||
|
]
|
||||||
|
},
|
||||||
verbose: {},
|
verbose: {},
|
||||||
version: {
|
version: {
|
||||||
multiOutput: [
|
multiOutput: [
|
||||||
|
|||||||
@@ -344,8 +344,10 @@ var Config = Module("config", ConfigBase, {
|
|||||||
modes: function (dactyl, modules, window) {
|
modes: function (dactyl, modules, window) {
|
||||||
const { config, modes } = modules;
|
const { config, modes } = modules;
|
||||||
config.ignoreKeys = {
|
config.ignoreKeys = {
|
||||||
"<Up>": modes.NORMAL | modes.INSERT,
|
"<Return>": modes.NORMAL,
|
||||||
"<Down>": modes.NORMAL | modes.INSERT
|
"<Space>": modes.NORMAL,
|
||||||
|
"<Up>": modes.NORMAL,
|
||||||
|
"<Down>": modes.NORMAL
|
||||||
};
|
};
|
||||||
config.modes.forEach(function (mode) { modes.addMode.apply(this, mode); });
|
config.modes.forEach(function (mode) { modes.addMode.apply(this, mode); });
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user