diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/components/places/tests/unifiedcomplete/test_match_beginning.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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_match_beginning.js')
-rw-r--r-- | toolkit/components/places/tests/unifiedcomplete/test_match_beginning.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/toolkit/components/places/tests/unifiedcomplete/test_match_beginning.js b/toolkit/components/places/tests/unifiedcomplete/test_match_beginning.js new file mode 100644 index 000000000..57a1efaeb --- /dev/null +++ b/toolkit/components/places/tests/unifiedcomplete/test_match_beginning.js @@ -0,0 +1,54 @@ +/* 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 bug 451760 which allows matching only at the beginning of urls or + * titles to simulate Firefox 2 functionality. + */ + +add_task(function* test_match_beginning() { + Services.prefs.setBoolPref("browser.urlbar.autoFill.searchEngines", false); + + let uri1 = NetUtil.newURI("http://x.com/y"); + let uri2 = NetUtil.newURI("https://y.com/x"); + yield PlacesTestUtils.addVisits([ + { uri: uri1, title: "a b" }, + { uri: uri2, title: "b a" } + ]); + + do_print("Match at the beginning of titles"); + Services.prefs.setIntPref("browser.urlbar.matchBehavior", 3); + yield check_autocomplete({ + search: "a", + matches: [ { uri: uri1, title: "a b" } ] + }); + + do_print("Match at the beginning of titles"); + yield check_autocomplete({ + search: "b", + matches: [ { uri: uri2, title: "b a" } ] + }); + + do_print("Match at the beginning of urls"); + yield check_autocomplete({ + search: "x", + matches: [ { uri: uri1, title: "a b" } ] + }); + + do_print("Match at the beginning of urls"); + yield check_autocomplete({ + search: "y", + matches: [ { uri: uri2, title: "b a" } ] + }); + + do_print("Sanity check that matching anywhere finds more"); + Services.prefs.setIntPref("browser.urlbar.matchBehavior", 1); + yield check_autocomplete({ + search: "a", + matches: [ { uri: uri1, title: "a b" }, + { uri: uri2, title: "b a" } ] + }); + + yield cleanup(); +}); |