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