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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /*
michael@0 5 * These tests make sure that dragging and dropping sites works as expected.
michael@0 6 * Sites contained in the grid need to shift around to indicate the result
michael@0 7 * of the drag-and-drop operation. If the grid is full and we're dragging
michael@0 8 * a new site into it another one gets pushed out.
michael@0 9 * This is a continuation of browser_newtab_drag_drop.js
michael@0 10 * to decrease test run time, focusing on external sites.
michael@0 11 */
michael@0 12 function runTests() {
michael@0 13 // drag a new site onto the very first cell
michael@0 14 yield setLinks("0,1,2,3,4,5,6,7,8");
michael@0 15 setPinnedLinks(",,,,,,,7,8");
michael@0 16
michael@0 17 yield addNewTabPageTab();
michael@0 18 checkGrid("0,1,2,3,4,5,6,7p,8p");
michael@0 19
michael@0 20 yield simulateExternalDrop(0);
michael@0 21 checkGrid("99p,0,1,2,3,4,5,7p,8p");
michael@0 22
michael@0 23 // drag a new site onto the grid and make sure that pinned cells don't get
michael@0 24 // pushed out
michael@0 25 yield setLinks("0,1,2,3,4,5,6,7,8");
michael@0 26 setPinnedLinks(",,,,,,,7,8");
michael@0 27
michael@0 28 yield addNewTabPageTab();
michael@0 29 checkGrid("0,1,2,3,4,5,6,7p,8p");
michael@0 30
michael@0 31 yield simulateExternalDrop(7);
michael@0 32 checkGrid("0,1,2,3,4,5,7p,99p,8p");
michael@0 33
michael@0 34 // drag a new site beneath a pinned cell and make sure the pinned cell is
michael@0 35 // not moved
michael@0 36 yield setLinks("0,1,2,3,4,5,6,7,8");
michael@0 37 setPinnedLinks(",,,,,,,,8");
michael@0 38
michael@0 39 yield addNewTabPageTab();
michael@0 40 checkGrid("0,1,2,3,4,5,6,7,8p");
michael@0 41
michael@0 42 yield simulateExternalDrop(7);
michael@0 43 checkGrid("0,1,2,3,4,5,6,99p,8p");
michael@0 44
michael@0 45 // drag a new site onto a block of pinned sites and make sure they're shifted
michael@0 46 // around accordingly
michael@0 47 yield setLinks("0,1,2,3,4,5,6,7,8");
michael@0 48 setPinnedLinks("0,1,2,,,,,,");
michael@0 49
michael@0 50 yield addNewTabPageTab();
michael@0 51 checkGrid("0p,1p,2p");
michael@0 52
michael@0 53 yield simulateExternalDrop(1);
michael@0 54 checkGrid("0p,99p,1p,2p,3,4,5,6,7");
michael@0 55 }

mercurial