1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/newtab/browser_newtab_drag_drop_ext.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/* 1.8 + * These tests make sure that dragging and dropping sites works as expected. 1.9 + * Sites contained in the grid need to shift around to indicate the result 1.10 + * of the drag-and-drop operation. If the grid is full and we're dragging 1.11 + * a new site into it another one gets pushed out. 1.12 + * This is a continuation of browser_newtab_drag_drop.js 1.13 + * to decrease test run time, focusing on external sites. 1.14 + */ 1.15 +function runTests() { 1.16 + // drag a new site onto the very first cell 1.17 + yield setLinks("0,1,2,3,4,5,6,7,8"); 1.18 + setPinnedLinks(",,,,,,,7,8"); 1.19 + 1.20 + yield addNewTabPageTab(); 1.21 + checkGrid("0,1,2,3,4,5,6,7p,8p"); 1.22 + 1.23 + yield simulateExternalDrop(0); 1.24 + checkGrid("99p,0,1,2,3,4,5,7p,8p"); 1.25 + 1.26 + // drag a new site onto the grid and make sure that pinned cells don't get 1.27 + // pushed out 1.28 + yield setLinks("0,1,2,3,4,5,6,7,8"); 1.29 + setPinnedLinks(",,,,,,,7,8"); 1.30 + 1.31 + yield addNewTabPageTab(); 1.32 + checkGrid("0,1,2,3,4,5,6,7p,8p"); 1.33 + 1.34 + yield simulateExternalDrop(7); 1.35 + checkGrid("0,1,2,3,4,5,7p,99p,8p"); 1.36 + 1.37 + // drag a new site beneath a pinned cell and make sure the pinned cell is 1.38 + // not moved 1.39 + yield setLinks("0,1,2,3,4,5,6,7,8"); 1.40 + setPinnedLinks(",,,,,,,,8"); 1.41 + 1.42 + yield addNewTabPageTab(); 1.43 + checkGrid("0,1,2,3,4,5,6,7,8p"); 1.44 + 1.45 + yield simulateExternalDrop(7); 1.46 + checkGrid("0,1,2,3,4,5,6,99p,8p"); 1.47 + 1.48 + // drag a new site onto a block of pinned sites and make sure they're shifted 1.49 + // around accordingly 1.50 + yield setLinks("0,1,2,3,4,5,6,7,8"); 1.51 + setPinnedLinks("0,1,2,,,,,,"); 1.52 + 1.53 + yield addNewTabPageTab(); 1.54 + checkGrid("0p,1p,2p"); 1.55 + 1.56 + yield simulateExternalDrop(1); 1.57 + checkGrid("0p,99p,1p,2p,3,4,5,6,7"); 1.58 +} 1.59 \ No newline at end of file