tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_dont_autofill_cases.js (1593B)


      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 * Tests some cases where autofill should not happen.
      7 */
      8 
      9 testEngine_setup();
     10 
     11 add_task(async function test_prefix_space_noautofill() {
     12  await PlacesTestUtils.addVisits({
     13    uri: Services.io.newURI("http://moz.org/test/"),
     14  });
     15 
     16  info("Should not try to autoFill if search string contains a space");
     17  let context = createContext(" mo", { isPrivate: false });
     18  await check_results({
     19    context,
     20    matches: [
     21      makeSearchResult(context, {
     22        engineName: SUGGESTIONS_ENGINE_NAME,
     23        query: " mo",
     24        heuristic: true,
     25      }),
     26      makeVisitResult(context, {
     27        uri: "http://moz.org/test/",
     28        title: "test visit for http://moz.org/test/",
     29      }),
     30    ],
     31  });
     32 
     33  await cleanupPlaces();
     34 });
     35 
     36 add_task(async function test_trailing_space_noautofill() {
     37  await PlacesTestUtils.addVisits({
     38    uri: Services.io.newURI("http://moz.org/test/"),
     39  });
     40 
     41  info("Should not try to autoFill if search string contains a space");
     42  let context = createContext("mo ", { isPrivate: false });
     43  await check_results({
     44    context,
     45    matches: [
     46      makeSearchResult(context, {
     47        engineName: SUGGESTIONS_ENGINE_NAME,
     48        query: "mo ",
     49        heuristic: true,
     50      }),
     51      makeVisitResult(context, {
     52        uri: "http://moz.org/test/",
     53        title: "test visit for http://moz.org/test/",
     54      }),
     55    ],
     56  });
     57 
     58  await cleanupPlaces();
     59 });