toolkit/components/places/tests/autocomplete/test_multi_word_search.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     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  */
    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 ];
    27 // Regular pages
    28 addPageBook(0, 0);
    29 addPageBook(1, 1);
    30 // Bookmarked pages
    31 addPageBook(2, 0, 0);
    32 addPageBook(3, 0, 1);
    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 ];

mercurial