michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /* michael@0: * These tests make sure that blocking/removing sites from the grid works michael@0: * as expected. Pinned tabs should not be moved. Gaps will be re-filled michael@0: * if more sites are available. michael@0: */ michael@0: function runTests() { michael@0: // we remove sites and expect the gaps to be filled as long as there still michael@0: // are some sites available michael@0: yield setLinks("0,1,2,3,4,5,6,7,8,9"); michael@0: setPinnedLinks(""); michael@0: michael@0: yield addNewTabPageTab(); michael@0: checkGrid("0,1,2,3,4,5,6,7,8"); michael@0: michael@0: yield blockCell(4); michael@0: checkGrid("0,1,2,3,5,6,7,8,9"); michael@0: michael@0: yield blockCell(4); michael@0: checkGrid("0,1,2,3,6,7,8,9,"); michael@0: michael@0: yield blockCell(4); michael@0: checkGrid("0,1,2,3,7,8,9,,"); michael@0: michael@0: // we removed a pinned site michael@0: yield restore(); michael@0: yield setLinks("0,1,2,3,4,5,6,7,8"); michael@0: setPinnedLinks(",1"); michael@0: michael@0: yield addNewTabPageTab(); michael@0: checkGrid("0,1p,2,3,4,5,6,7,8"); michael@0: michael@0: yield blockCell(1); michael@0: checkGrid("0,2,3,4,5,6,7,8,"); michael@0: michael@0: // we remove the last site on the grid (which is pinned) and expect the gap michael@0: // to be re-filled and the new site to be unpinned michael@0: yield restore(); michael@0: yield setLinks("0,1,2,3,4,5,6,7,8,9"); michael@0: setPinnedLinks(",,,,,,,,8"); michael@0: michael@0: yield addNewTabPageTab(); michael@0: checkGrid("0,1,2,3,4,5,6,7,8p"); michael@0: michael@0: yield blockCell(8); michael@0: checkGrid("0,1,2,3,4,5,6,7,9"); michael@0: michael@0: // we remove the first site on the grid with the last one pinned. all cells michael@0: // but the last one should shift to the left and a new site fades in michael@0: yield restore(); michael@0: yield setLinks("0,1,2,3,4,5,6,7,8,9"); michael@0: setPinnedLinks(",,,,,,,,8"); michael@0: michael@0: yield addNewTabPageTab(); michael@0: checkGrid("0,1,2,3,4,5,6,7,8p"); michael@0: michael@0: yield blockCell(0); michael@0: checkGrid("1,2,3,4,5,6,7,9,8p"); michael@0: }