summaryrefslogtreecommitdiffstats
path: root/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:55:19 +0200
commiteb70e6e3d0bff11c25f14b1196025791bf2308fb (patch)
tree5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/autocomplete/tests/unit/test_hiddenResult.js
parent32ead795290b3399d56b4708fc75b77d296f6a1a (diff)
downloadUXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/autocomplete/tests/unit/test_hiddenResult.js')
-rw-r--r--toolkit/components/autocomplete/tests/unit/test_hiddenResult.js76
1 files changed, 0 insertions, 76 deletions
diff --git a/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js b/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js
deleted file mode 100644
index 8e2485716..000000000
--- a/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function AutoCompleteResult(aValues) {
- this._values = aValues;
- this.defaultIndex = -1;
- this._typeAheadResult = false;
-}
-AutoCompleteResult.prototype = Object.create(AutoCompleteResultBase.prototype);
-
-function AutoCompleteTypeAheadResult(aValues) {
- this._values = aValues;
- this.defaultIndex = 0;
- this._typeAheadResult = true;
-}
-AutoCompleteTypeAheadResult.prototype = Object.create(AutoCompleteResultBase.prototype);
-
-
-/**
- * Test AutoComplete with multiple AutoCompleteSearch sources, with one of them
- * being hidden from the popup, but can still do typeahead completion.
- */
-function run_test() {
- do_test_pending();
-
- var inputStr = "moz";
-
- // Type ahead result
- var searchTypeAhead = new AutoCompleteSearchBase("search1",
- new AutoCompleteTypeAheadResult(["mozillaTest1"]));
- // Regular result
- var searchNormal = new AutoCompleteSearchBase("search2",
- new AutoCompleteResult(["mozillaTest2"]));
-
- // Register searches so AutoCompleteController can find them
- registerAutoCompleteSearch(searchNormal);
- registerAutoCompleteSearch(searchTypeAhead);
-
- // Make an AutoCompleteInput that uses our searches
- // and confirms results on search complete.
- var input = new AutoCompleteInputBase([searchTypeAhead.name, searchNormal.name]);
- input.completeDefaultIndex = true;
- input.textValue = inputStr;
-
- // Caret must be at the end. Autofill doesn't happen unless you're typing
- // characters at the end.
- var strLen = inputStr.length;
- input.selectTextRange(strLen, strLen);
- do_check_eq(input.selectionStart, strLen);
- do_check_eq(input.selectionEnd, strLen);
-
- var controller = Cc["@mozilla.org/autocomplete/controller;1"].
- getService(Ci.nsIAutoCompleteController);
-
- controller.input = input;
- controller.startSearch(inputStr);
-
- input.onSearchComplete = function() {
- // Hidden results should still be able to do inline autocomplete
- do_check_eq(input.textValue, "mozillaTest1");
-
- // Now, let's fill the textbox with the first result of the popup.
- // The first search is marked as hidden, so we must always get the
- // second search.
- controller.handleEnter(true);
- do_check_eq(input.textValue, "mozillaTest2");
-
- // Only one item in the popup.
- do_check_eq(controller.matchCount, 1);
-
- // Unregister searches
- unregisterAutoCompleteSearch(searchNormal);
- unregisterAutoCompleteSearch(searchTypeAhead);
- do_test_finished();
- };
-}