Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  browser_bug1198465.js   Sprache: JAVA

 
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */


var kPrefName = "accessibility.typeaheadfind.prefillwithselection";
var kEmptyURI = "data:text/html,";

// This pref is false by default in OSX; ensure the test still works there.
Services.prefs.setBoolPref(kPrefName, true);

registerCleanupFunction(function () {
  Services.prefs.clearUserPref(kPrefName);
});

add_task(async function () {
  let aTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, kEmptyURI);
  ok(!gFindBarInitialized, "findbar isn't initialized yet");

  // Note: the use case here is when the user types directly in the findbar
  // _before_ it's prefilled with a text selection in the page.

  // So `yield BrowserTestUtils.sendChar()` can't be used here:
  //  - synthesizing a key in the browser won't actually send it to the
  //    findbar; the findbar isn't part of the browser content.
  //  - we need to _not_ wait for _startFindDeferred to be resolved; yielding
  //    a synthesized keypress on the browser implicitely happens after the
  //    browser has dispatched its return message with the prefill value for
  //    the findbar, which essentially nulls these tests.

  // The parent-side of the sidebar initialization is also async, so we do
  // need to wait for that. We verify a bit further down that _startFindDeferred
  // hasn't been resolved yet.
  await gFindBarPromise;

  let findBar = gFindBar;
  is(findBar._findField.value, """findbar is empty");

  // Test 1
  //  Any input in the findbar should erase a previous search.

  findBar._findField.value = "xy";
  findBar.startFind();
  is(findBar._findField.value, "xy""findbar should have xy initial query");
  is(findBar._findField, document.activeElement, "findbar is now focused");

  EventUtils.sendChar("z", window);
  is(findBar._findField.value, "z""z erases xy");

  findBar._findField.value = "";
  ok(!findBar._findField.value, "erase findbar after first test");

  // Test 2
  //  Prefilling the findbar should be ignored if a search has been run.

  findBar.startFind();
  ok(findBar._startFindDeferred, "prefilled value hasn't been fetched yet");
  is(findBar._findField, document.activeElement, "findbar is still focused");

  EventUtils.sendChar("a", window);
  EventUtils.sendChar("b", window);
  is(findBar._findField.value, "ab""initial ab typed in the findbar");

  // This resolves _startFindDeferred if it's still pending; let's just skip
  // over waiting for the browser's return message that should do this as it
  // doesn't really matter.
  findBar.onCurrentSelection("foo"true);
  ok(!findBar._startFindDeferred, "prefilled value fetched");
  is(findBar._findField.value, "ab""ab kept instead of prefill value");

  EventUtils.sendChar("c", window);
  is(findBar._findField.value, "abc""c is appended after ab");

  // Clear the findField value to make the test  run successfully
  // for multiple runs in the same browser session.
  findBar._findField.value = "";
  BrowserTestUtils.removeTab(aTab);
});

Messung V0.5
C=92 H=92 G=91

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge