diff options
Diffstat (limited to 'comm/suite/components/tests/browser/browser_485482.js')
-rw-r--r-- | comm/suite/components/tests/browser/browser_485482.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/comm/suite/components/tests/browser/browser_485482.js b/comm/suite/components/tests/browser/browser_485482.js new file mode 100644 index 0000000000..6e4573f609 --- /dev/null +++ b/comm/suite/components/tests/browser/browser_485482.js @@ -0,0 +1,36 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +function test() { + /** Test for Bug 485482, ported by Bug 487922 **/ + + waitForExplicitFinish(); + + let uniqueValue = Math.random(); + + let rootDir = getRootDirectory(gTestPath); + let testURL = rootDir + "browser_485482_sample.html"; + let tab = getBrowser().addTab(testURL); + tab.linkedBrowser.addEventListener("load", function testTabLBLoad(aEvent) { + tab.linkedBrowser.removeEventListener("load", testTabLBLoad, true); + let doc = tab.linkedBrowser.contentDocument; + doc.querySelector("input[type=text]").value = uniqueValue; + doc.querySelector("input[type=checkbox]").checked = true; + + let tab2 = ss.duplicateTab(window, tab); + tab2.linkedBrowser.addEventListener("load", function testTab2LBLoad(aEvent) { + tab2.linkedBrowser.removeEventListener("load", testTab2LBLoad, true); + doc = tab2.linkedBrowser.contentDocument; + is(doc.querySelector("input[type=text]").value, uniqueValue, + "generated XPath expression was valid"); + ok(doc.querySelector("input[type=checkbox]").checked, + "generated XPath expression was valid"); + + // clean up + getBrowser().removeTab(tab2); + getBrowser().removeTab(tab); + finish(); + }, true); + }, true); +} |