Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.test_commands = function(test) {
test.pass("Test Commands .....");
// 先頭に戻す
commands.setLinkFormIndex(0);
// 前回の値でリンク生成
commands.redoLink("redo test", {text: "TEXT", title: "TITLE", url: "http://www.example.jp"});
test.assertEqual("TEXT\nhttp://www.example.jp", clipboard.get());
// 全てのタブをリンク
commands.allTabs("DUMMY", "%text%\\n%url%");
test.assertEqual("\nabout:blank\n", clipboard.get());
commands.allTabsSpace("DUMMY", "%text%\\n%url%");
test.assertEqual("\nabout:blank\n\n", clipboard.get());
// リンク種類を直接設定
commands.setLinkFormIndex(0);
test.assertEqual(0, fl.currentIndex());
commands.setLinkFormIndex(1);
test.assertEqual(1, fl.currentIndex());
commands.setLinkFormIndex(2);
test.assertEqual(2, fl.currentIndex());
commands.setLinkFormIndex(3);
test.assertEqual(3, fl.currentIndex());
commands.setLinkFormIndex(500);
test.assertEqual(3, fl.currentIndex());
// Export
commands.exportFromClipboard();
// let text =
function test_copyLinkAndNotify(test) {
let linkdata = {text: "YAAOO!! JIPAN", title: "YAAOO!! JIPAN", url: "http://www.example.jp"};
fl.copyLinkAndNotify("DUMMY", "%text%\\n%url%", linkdata);
test.assertEqual("YAAOO!! JIPAN\nhttp://www.example.jp", clipboard.get());
fl.copyLinkAndNotify("DUMMY2", "<a href="\"%url%\"">%text%</a>", linkdata);
test.assertEqual("<a href="\"http://www.example.jp\"">YAAOO!! JIPAN</a>", clipboard.get());
}
let item = {
label: "test-menu_lib"
};
let action = {
linkform: "[[%text%|%url%]]",
item: item
};
let linkdata = {text: "TEXT",
title: "TITLE",
url: "http://www.example.jp"};
MenuLib.redoLink(action, linkdata);
test.assertEqual("[[TEXT|http://www.example.jp]]", clipboard.get());
MenuLib.changeLinkform(action, linkdata);
test.assertEqual("[[TEXT|http://www.example.jp]]", clipboard.get());
MenuLib.copyTabs(action, linkdata);
};