|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 /** |
|
6 * Test for bug 401869 to allow multiple words separated by spaces to match in |
|
7 * the page title, page url, or bookmark title to be considered a match. All |
|
8 * terms must match but not all terms need to be in the title, etc. |
|
9 * |
|
10 * Test bug 424216 by making sure bookmark titles are always shown if one is |
|
11 * available. Also bug 425056 makes sure matches aren't found partially in the |
|
12 * page title and partially in the bookmark. |
|
13 */ |
|
14 |
|
15 // Define some shared uris and titles (each page needs its own uri) |
|
16 let kURIs = [ |
|
17 "http://a.b.c/d-e_f/h/t/p", |
|
18 "http://d.e.f/g-h_i/h/t/p", |
|
19 "http://g.h.i/j-k_l/h/t/p", |
|
20 "http://j.k.l/m-n_o/h/t/p", |
|
21 ]; |
|
22 let kTitles = [ |
|
23 "f(o)o b<a>r", |
|
24 "b(a)r b<a>z", |
|
25 ]; |
|
26 |
|
27 // Regular pages |
|
28 addPageBook(0, 0); |
|
29 addPageBook(1, 1); |
|
30 // Bookmarked pages |
|
31 addPageBook(2, 0, 0); |
|
32 addPageBook(3, 0, 1); |
|
33 |
|
34 // Provide for each test: description; search terms; array of gPages indices of |
|
35 // pages that should match; optional function to be run before the test |
|
36 let gTests = [ |
|
37 ["0: Match 2 terms all in url", |
|
38 "c d", [0]], |
|
39 ["1: Match 1 term in url and 1 term in title", |
|
40 "b e", [0,1]], |
|
41 ["2: Match 3 terms all in title; display bookmark title if matched", |
|
42 "b a z", [1,3]], |
|
43 ["3: Match 2 terms in url and 1 in title; make sure bookmark title is used for search", |
|
44 "k f t", [2]], |
|
45 ["4: Match 3 terms in url and 1 in title", |
|
46 "d i g z", [1]], |
|
47 ["5: Match nothing", |
|
48 "m o z i", []], |
|
49 ]; |