summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js')
-rw-r--r--toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js68
1 files changed, 68 insertions, 0 deletions
diff --git a/toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js b/toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js
new file mode 100644
index 000000000..c6c9e952e
--- /dev/null
+++ b/toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js
@@ -0,0 +1,68 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/**
+ * Test for bug 401869 to allow multiple words separated by spaces to match in
+ * the page title, page url, or bookmark title to be considered a match. All
+ * terms must match but not all terms need to be in the title, etc.
+ *
+ * Test bug 424216 by making sure bookmark titles are always shown if one is
+ * available. Also bug 425056 makes sure matches aren't found partially in the
+ * page title and partially in the bookmark.
+ */
+
+add_task(function* test_match_beginning() {
+ let uri1 = NetUtil.newURI("http://a.b.c/d-e_f/h/t/p");
+ let uri2 = NetUtil.newURI("http://d.e.f/g-h_i/h/t/p");
+ let uri3 = NetUtil.newURI("http://g.h.i/j-k_l/h/t/p");
+ let uri4 = NetUtil.newURI("http://j.k.l/m-n_o/h/t/p");
+ yield PlacesTestUtils.addVisits([
+ { uri: uri1, title: "f(o)o b<a>r" },
+ { uri: uri2, title: "b(a)r b<a>z" },
+ { uri: uri3, title: "f(o)o b<a>r" },
+ { uri: uri4, title: "f(o)o b<a>r" }
+ ]);
+ yield addBookmark({ uri: uri3, title: "f(o)o b<a>r" });
+ yield addBookmark({ uri: uri4, title: "b(a)r b<a>z" });
+
+ do_print("Match 2 terms all in url");
+ yield check_autocomplete({
+ search: "c d",
+ matches: [ { uri: uri1, title: "f(o)o b<a>r" } ]
+ });
+
+ do_print("Match 1 term in url and 1 term in title");
+ yield check_autocomplete({
+ search: "b e",
+ matches: [ { uri: uri1, title: "f(o)o b<a>r" },
+ { uri: uri2, title: "b(a)r b<a>z" } ]
+ });
+
+ do_print("Match 3 terms all in title; display bookmark title if matched");
+ yield check_autocomplete({
+ search: "b a z",
+ matches: [ { uri: uri2, title: "b(a)r b<a>z" },
+ { uri: uri4, title: "b(a)r b<a>z", style: [ "bookmark" ] } ]
+ });
+
+ do_print("Match 2 terms in url and 1 in title; make sure bookmark title is used for search");
+ yield check_autocomplete({
+ search: "k f t",
+ matches: [ { uri: uri3, title: "f(o)o b<a>r", style: [ "bookmark" ] } ]
+ });
+
+ do_print("Match 3 terms in url and 1 in title");
+ yield check_autocomplete({
+ search: "d i g z",
+ matches: [ { uri: uri2, title: "b(a)r b<a>z" } ]
+ });
+
+ do_print("Match nothing");
+ yield check_autocomplete({
+ search: "m o z i",
+ matches: [ ]
+ });
+
+ yield cleanup();
+});