browser/base/content/test/newtab/browser_newtab_bug998387.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/newtab/browser_newtab_bug998387.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,25 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function runTests() {
     1.8 +  yield setLinks("0");
     1.9 +  yield addNewTabPageTab();
    1.10 +
    1.11 +  // Remember if the click handler was triggered
    1.12 +  let {site} = getCell(0);
    1.13 +  let origOnClick = site.onClick;
    1.14 +  let clicked = false;
    1.15 +  site.onClick = e => {
    1.16 +    origOnClick.call(site, e);
    1.17 +    clicked = true;
    1.18 +    executeSoon(TestRunner.next);
    1.19 +  };
    1.20 +
    1.21 +  // Send a middle-click and make sure it happened
    1.22 +  let block = getContentDocument().querySelector(".newtab-control-block");
    1.23 +  yield EventUtils.synthesizeMouseAtCenter(block, {button: 1}, getContentWindow());
    1.24 +  ok(clicked, "middle click triggered click listener");
    1.25 +
    1.26 +  // Make sure the cell didn't actually get blocked
    1.27 +  checkGrid("0");
    1.28 +}

mercurial