michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0:
michael@0: /**
michael@0: * Test for bug 401869 to allow multiple words separated by spaces to match in
michael@0: * the page title, page url, or bookmark title to be considered a match. All
michael@0: * terms must match but not all terms need to be in the title, etc.
michael@0: *
michael@0: * Test bug 424216 by making sure bookmark titles are always shown if one is
michael@0: * available. Also bug 425056 makes sure matches aren't found partially in the
michael@0: * page title and partially in the bookmark.
michael@0: */
michael@0:
michael@0: // Define some shared uris and titles (each page needs its own uri)
michael@0: let kURIs = [
michael@0: "http://a.b.c/d-e_f/h/t/p",
michael@0: "http://d.e.f/g-h_i/h/t/p",
michael@0: "http://g.h.i/j-k_l/h/t/p",
michael@0: "http://j.k.l/m-n_o/h/t/p",
michael@0: ];
michael@0: let kTitles = [
michael@0: "f(o)o br",
michael@0: "b(a)r bz",
michael@0: ];
michael@0:
michael@0: // Regular pages
michael@0: addPageBook(0, 0);
michael@0: addPageBook(1, 1);
michael@0: // Bookmarked pages
michael@0: addPageBook(2, 0, 0);
michael@0: addPageBook(3, 0, 1);
michael@0:
michael@0: // Provide for each test: description; search terms; array of gPages indices of
michael@0: // pages that should match; optional function to be run before the test
michael@0: let gTests = [
michael@0: ["0: Match 2 terms all in url",
michael@0: "c d", [0]],
michael@0: ["1: Match 1 term in url and 1 term in title",
michael@0: "b e", [0,1]],
michael@0: ["2: Match 3 terms all in title; display bookmark title if matched",
michael@0: "b a z", [1,3]],
michael@0: ["3: Match 2 terms in url and 1 in title; make sure bookmark title is used for search",
michael@0: "k f t", [2]],
michael@0: ["4: Match 3 terms in url and 1 in title",
michael@0: "d i g z", [1]],
michael@0: ["5: Match nothing",
michael@0: "m o z i", []],
michael@0: ];