Test for bug 584630 (Find / FAYT is not focusing on correct tab), r=mcsmurf
authorRobert Kaiser <kairo@kairo.at>
Tue, 24 Aug 2010 17:47:07 +0200
changeset 6261 59416744bb13d69797cff73f6ab5259fb479d457
parent 6260 cbc4d2746097bcea2aa161ffb5de72ed03f55da0
child 6262 5797048efddd217149617d9d8a1935188fc9f0e1
push id4830
push userkairo@kairo.at
push dateTue, 24 Aug 2010 15:47:28 +0000
treeherdercomm-central@59416744bb13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcsmurf
bugs584630
Test for bug 584630 (Find / FAYT is not focusing on correct tab), r=mcsmurf
suite/browser/test/Makefile.in
suite/browser/test/browser/browser_fayt.js
--- a/suite/browser/test/Makefile.in
+++ b/suite/browser/test/Makefile.in
@@ -55,16 +55,17 @@ include $(topsrcdir)/config/rules.mk
 		bug364677-data.xml \
 		bug364677-data.xml^headers^ \
 		$(NULL)
 
 _BROWSER_FILES = browser_bug413915.js \
                  browser_bug427559.js \
                  browser_bug562649.js \
                  browser_bug585511.js \
+                 browser_fayt.js \
                  browser_page_style_menu.js \
                  page_style_sample.html \
                  browser_feed_tab.js \
                  feed_tab.html \
                  browser_pluginnotification.js \
                  plugin_unknown.html \
                  plugin_test.html \
                  plugin_both.html \
new file mode 100644
--- /dev/null
+++ b/suite/browser/test/browser/browser_fayt.js
@@ -0,0 +1,25 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+function test() {
+  var tab1 = gBrowser.addTab("data:text/html,<p>this is some dummy text</p>");
+  var tab2 = gBrowser.addTab("data:text/html,<p>this is some random text</p>");
+
+  gBrowser.getBrowserForTab(tab2).addEventListener("load", runTest, true);
+  waitForExplicitFinish();
+
+  function runTest() {
+    gBrowser.getBrowserForTab(tab2).removeEventListener("load", runTest, true);
+
+    gBrowser.selectedTab = tab2;
+    is(gBrowser.fastFind.find("random", false), Components.interfaces.nsITypeAheadFind.FIND_FOUND, "FAYT found the random text");
+    gBrowser.selectedTab = tab1;
+    is(gBrowser.fastFind.find("dummy", false), Components.interfaces.nsITypeAheadFind.FIND_FOUND, "FAYT found the dummy text");
+
+    gBrowser.removeTab(tab2);
+    gBrowser.removeTab(tab1);
+    finish();
+  }
+}
+