2 require('index-webjump.js');
5 suite_setup: function () {
6 this.real_webjumps = webjumps;
7 this.real_index_webjumps = index_webjumps;
8 conkeror.webjumps = {};
9 conkeror.index_webjumps = {};
11 suite_teardown: function () {
12 conkeror.webjumps = this.real_webjumps;
13 conkeror.index_webjumps = this.real_index_webjumps;
15 path: make_file_from_chrome("chrome://conkeror-test/content/simple").path,
16 test_xpath_webjump: function () {
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");
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");