newsblur-mode: more keymap updates
[conkeror.git] / tests / simple / index-webjump.js
blobf89e824a52e396dfa8f45e17dc0e47ca32414006
1 require('walnut.js');
2 require('index-webjump.js');
4 { let suite = {
5       suite_setup: function () {
6           this.real_webjumps = webjumps;
7           this.real_index_webjumps = index_webjumps;
8           conkeror.webjumps = {};
9           conkeror.index_webjumps = {};
10       },
11       suite_teardown: function () {
12           conkeror.webjumps = this.real_webjumps;
13           conkeror.index_webjumps = this.real_index_webjumps;
14       },
15       path: make_file_from_chrome("chrome://conkeror-test/content/simple").path,
16       test_xpath_webjump: function () {
17           define_xpath_webjump(
18               "xpath", "http://dummy/xpath", '//xhtml:a[@class="index"]',
19               $index_file = this.path + '/xpath-webjump-test.xhtml');
20           var w = index_webjumps.xpath;
21           w.extract_completions();
22           assert_equals(get_webjump("xpath foo"), "foo");
23           assert_equals(w.completions.length, 2);
24           assert_equals(w.completions[0][1], "The bar");
25           assert_equals(w.completions[0][0], "http://dummy/xpath/bar");
26           assert_equals(w.completions[1][1], "The foo");
27           assert_equals(w.completions[1][0], "http://dummy/foo");
28       },
29       test_gitweb_webjump: function() {
30           define_gitweb_summary_webjump(
31               "gitweb", "http://dummy/gitweb", $default = "bar",
32               $opml_file = this.path + '/gitweb-webjump-test.opml');
33           assert_equals(get_webjump("gitweb"),
34                         "http://dummy/gitweb/gitweb.cgi?p=bar.git;a=summary");
35           assert_equals(get_webjump("gitweb foo"),
36                         "http://dummy/gitweb/gitweb.cgi?p=foo.git;a=summary");
37           var w = index_webjumps.gitweb;
38           w.extract_completions();
39           assert_equals(w.completions.length, 2);
40           assert_equals(w.completions[0][0], "bar");
41           assert_equals(w.completions[1][0], "foo");
42       },
43   };
44   walnut_run(suite);