browser_jsterm_completion_perfect_match.js (1196B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Tests that code completion works properly in regards to case sensitivity. 5 6 "use strict"; 7 8 const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><p>test completion perfect match. 9 <script> 10 x = Object.create(null, Object.getOwnPropertyDescriptors({ 11 foo: 1, 12 foO: 2, 13 fOo: 3, 14 fOO: 4, 15 })); 16 </script>`; 17 18 add_task(async function () { 19 const hud = await openNewTabAndConsole(TEST_URI); 20 const { jsterm } = hud; 21 const { autocompletePopup } = jsterm; 22 23 info("Check that filtering the cache works like on the server"); 24 await setInputValueForAutocompletion(hud, "x."); 25 ok( 26 hasExactPopupLabels(autocompletePopup, ["foo", "foO", "fOo", "fOO"]), 27 "popup has expected item, in expected order" 28 ); 29 30 const onAutoCompleteUpdated = jsterm.once("autocomplete-updated"); 31 EventUtils.sendString("foO"); 32 await onAutoCompleteUpdated; 33 ok( 34 hasExactPopupLabels(autocompletePopup, ["foO", "foo", "fOo", "fOO"]), 35 "popup has expected item, in expected order" 36 ); 37 38 info("Close autocomplete popup"); 39 await closeAutocompletePopup(hud); 40 });