Skip to content

Commit

Permalink
Bug 1306266 - test for print preview using the right tab, r=mconley
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: LLFmpPWwc5d

UltraBlame original commit: 38485e7430ba0a2107ddbb617e027ac00a688813
  • Loading branch information
marco-c committed Sep 30, 2019
1 parent 750be22 commit 12323d9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions browser/base/content/test/tabs/browser.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[browser_tabSpinnerProbe.js]
skip-if = !e10s # Tab spinner is e10s only.
[browser_tabSwitchPrintPreview.js]
skip-if = os == 'mac'
23 changes: 23 additions & 0 deletions browser/base/content/test/tabs/browser_tabSwitchPrintPreview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const kURL1 = "data:text/html,Should I stay or should I go?";
const kURL2 = "data:text/html,I shouldn't be here!";





add_task(function* () {
yield BrowserTestUtils.withNewTab(kURL1, function* (browser) {
let tab = gBrowser.addTab(kURL2);
document.getElementById("cmd_printPreview").doCommand();
gBrowser.selectedTab = tab;
yield BrowserTestUtils.waitForCondition(() => gInPrintPreviewMode, "should be in print preview mode");
isnot(gBrowser.selectedTab, tab, "Selected tab should not be the tab we added");
is(gBrowser.selectedTab, PrintPreviewListener._printPreviewTab, "Selected tab should be the print preview tab");
gBrowser.selectedTab = tab;
isnot(gBrowser.selectedTab, tab, "Selected tab should still not be the tab we added");
is(gBrowser.selectedTab, PrintPreviewListener._printPreviewTab, "Selected tab should still be the print preview tab");
PrintUtils.exitPrintPreview();
yield BrowserTestUtils.waitForCondition(() => !gInPrintPreviewMode, "should be in print preview mode");
yield BrowserTestUtils.removeTab(tab);
});
});

0 comments on commit 12323d9

Please sign in to comment.