Commit 66422047 authored by Kristi Park's avatar Kristi Park Committed by Commit Bot

[NTP] Clean-up GridLayoutForNtpShortcuts and remove old reorder flow

Bug: 851335
Change-Id: Ib73f8952c5e0e01f8a2f9523bfec65d5cf34b55e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1854418
Commit-Queue: Kristi Park <kristipark@chromium.org>
Reviewed-by: default avatarKyle Milka <kmilka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705755}
parent 18d41172
...@@ -27,7 +27,6 @@ let MostVisitedData; ...@@ -27,7 +27,6 @@ let MostVisitedData;
* chrome/browser/search/local_ntp_source.cc: * chrome/browser/search/local_ntp_source.cc:
* LocalNtpSource::SearchConfigurationProvider::UpdateConfigData() * LocalNtpSource::SearchConfigurationProvider::UpdateConfigData()
* @typedef {{chromeColors: boolean, * @typedef {{chromeColors: boolean,
* enableShortcutsGrid: boolean,
* googleBaseUrl: string, * googleBaseUrl: string,
* isAccessibleBrowser: boolean, * isAccessibleBrowser: boolean,
* isGooglePage: boolean, * isGooglePage: boolean,
......
...@@ -370,9 +370,6 @@ function createIframes() { ...@@ -370,9 +370,6 @@ function createIframes() {
if (configData.isGooglePage) { if (configData.isGooglePage) {
args.push('enableCustomLinks=1'); args.push('enableCustomLinks=1');
if (configData.enableShortcutsGrid) {
args.push('enableGrid=1');
}
args.push( args.push(
'addLink=' + 'addLink=' +
encodeURIComponent(configData.translatedStrings.addLinkTitle)); encodeURIComponent(configData.translatedStrings.addLinkTitle));
......
...@@ -54,31 +54,13 @@ a:visited { ...@@ -54,31 +54,13 @@ a:visited {
#mv-tiles, #mv-tiles,
.mv-tiles-old { .mv-tiles-old {
display: flex;
flex-wrap: wrap;
font-size: 0; font-size: 0;
justify-content: center;
/* 5 112px tiles per row. If you change this, also change the corresponding
* values in local_ntp.css. */
max-width: calc(var(--md-tile-size) * var(--md-max-tiles-row));
opacity: 0; opacity: 0;
position: static; position: relative;
/* This align correctly for both LTR and RTL */
text-align: -webkit-auto;
transition: opacity 300ms; transition: opacity 300ms;
user-select: none; user-select: none;
} }
body.grid-layout #mv-tiles,
body.grid-layout .mv-tiles-old {
display: block;
flex-wrap: unset;
justify-content: unset;
max-width: unset;
position: relative;
text-align: unset;
}
.mv-tiles-old { .mv-tiles-old {
left: 0; left: 0;
margin: auto; margin: auto;
...@@ -101,11 +83,11 @@ body.grid-layout .mv-tiles-old { ...@@ -101,11 +83,11 @@ body.grid-layout .mv-tiles-old {
/* Prevent transitions on the held tile in order for it to smoothly follow the /* Prevent transitions on the held tile in order for it to smoothly follow the
* mouse. */ * mouse. */
.grid-reorder .grid-tile { .reorder .grid-tile {
transition-duration: 0s; transition-duration: 0s;
} }
.grid-reorder { .reorder {
z-index: 10; /* Ensure the held tile is visible. */ z-index: 10; /* Ensure the held tile is visible. */
} }
...@@ -124,46 +106,24 @@ body.grid-layout .mv-tiles-old { ...@@ -124,46 +106,24 @@ body.grid-layout .mv-tiles-old {
width: var(--md-tile-size); width: var(--md-tile-size);
} }
.reorder {
background-color: white;
border-radius: 4px;
box-shadow: 0 1px 3px 0 rgba(var(--GG800-rgb), .3),
0 4px 8px 3px rgba(var(--GG800-rgb), .15);
color: rgb(var(--GG800-rgb));
transition-duration: 200ms;
}
@media (prefers-color-scheme: dark) {
.reorder {
background-color: rgb(var(--dark-mode-bg-rgb));
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .4),
0 4px 8px 3px rgba(0, 0, 0, .25);
color: rgb(var(--GG100-rgb));
}
}
.reorder .md-tile-inner {
z-index: unset;
}
.md-empty-tile { .md-empty-tile {
display: none; display: none;
} }
body:not(.reordering) .md-tile:hover, body:not(.reordering) .md-tile:hover,
.grid-reorder .md-tile { .reorder .md-tile {
background-color: rgba(var(--GG900-rgb), .06); background-color: rgba(var(--GG900-rgb), .06);
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
body:not(.reordering) .md-tile:hover, body:not(.reordering) .md-tile:hover,
.grid-reorder .md-tile { .reorder .md-tile {
background-color: rgba(255, 255, 255, .1); background-color: rgba(255, 255, 255, .1);
} }
} }
body.dark-theme:not(.reordering) .md-tile:hover, body.dark-theme:not(.reordering) .md-tile:hover,
body.dark-theme .grid-reorder .md-tile { body.dark-theme .reorder .md-tile {
background-color: rgba(255, 255, 255, .1); background-color: rgba(255, 255, 255, .1);
} }
...@@ -254,7 +214,7 @@ body.mac-chromeos .md-title { ...@@ -254,7 +214,7 @@ body.mac-chromeos .md-title {
} }
/* Apply when a custom background is set. */ /* Apply when a custom background is set. */
body.custom-background .md-tile:not(.reorder) .md-title { body.custom-background .md-title {
filter: drop-shadow(0 0 6px rgba(0, 0, 0, .35)); filter: drop-shadow(0 0 6px rgba(0, 0, 0, .35));
} }
...@@ -263,12 +223,9 @@ body.use-title-container .md-title { ...@@ -263,12 +223,9 @@ body.use-title-container .md-title {
background-color: white; background-color: white;
/* Necessary for a "pill" shape. Using 50% creates an oval. */ /* Necessary for a "pill" shape. Using 50% creates an oval. */
border-radius: 500px; border-radius: 500px;
padding: 0 8px;
}
body.use-title-container .md-tile:not(.reorder) {
color: rgb(var(--GG800-rgb)); color: rgb(var(--GG800-rgb));
filter: unset; filter: unset;
padding: 0 8px;
} }
.md-menu { .md-menu {
...@@ -343,13 +300,13 @@ body:not(.reordering) .md-menu:focus::after { ...@@ -343,13 +300,13 @@ body:not(.reordering) .md-menu:focus::after {
} }
} }
body.dark-theme .md-tile:not(.reorder) .md-menu::after, body.dark-theme .md-tile .md-menu::after,
body.dark-theme:not(.reordering) .md-menu:focus:not(.mouse-navigation)::after { body.dark-theme:not(.reordering) .md-menu:focus:not(.mouse-navigation)::after {
background-color: white; background-color: white;
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
body.dark-theme .md-tile:not(.reorder) .md-menu::after, body.dark-theme .md-tile .md-menu::after,
body.dark-theme:not(.reordering) body.dark-theme:not(.reordering)
.md-menu:focus:not(.mouse-navigation)::after { .md-menu:focus:not(.mouse-navigation)::after {
background-color: rgb(var(--GG200-rgb)); background-color: rgb(var(--GG200-rgb));
......
...@@ -46,9 +46,6 @@ const IDS = { ...@@ -46,9 +46,6 @@ const IDS = {
*/ */
const CLASSES = { const CLASSES = {
FAILED_FAVICON: 'failed-favicon', // Applied when the favicon fails to load. FAILED_FAVICON: 'failed-favicon', // Applied when the favicon fails to load.
GRID_LAYOUT: 'grid-layout',
// Applied to the grid tile being moved while reordering.
GRID_REORDER: 'grid-reorder',
GRID_TILE: 'grid-tile', GRID_TILE: 'grid-tile',
GRID_TILE_CONTAINER: 'grid-tile-container', GRID_TILE_CONTAINER: 'grid-tile-container',
REORDER: 'reorder', // Applied to the tile being moved while reordering. REORDER: 'reorder', // Applied to the tile being moved while reordering.
...@@ -170,19 +167,6 @@ let tiles = null; ...@@ -170,19 +167,6 @@ let tiles = null;
*/ */
let queryArgs = {}; let queryArgs = {};
/**
* True if we are currently reordering the tiles.
* @type {boolean}
*/
let reordering = false;
/**
* The tile that is being moved during the reorder flow. Null if we are
* currently not reordering.
* @type {?Element}
*/
let elementToReorder = null;
/** /**
* True if the custom links feature is enabled, i.e. when this is a Google NTP. * True if the custom links feature is enabled, i.e. when this is a Google NTP.
* Set when the iframe is initialized. * Set when the iframe is initialized.
...@@ -190,26 +174,12 @@ let elementToReorder = null; ...@@ -190,26 +174,12 @@ let elementToReorder = null;
*/ */
let customLinksFeatureEnabled = false; let customLinksFeatureEnabled = false;
/**
* True if the grid layout is enabled.
* @type {boolean}
*/
let isGridEnabled = false;
/** /**
* The current grid of tiles. * The current grid of tiles.
* @type {?Grid} * @type {?Grid}
*/ */
let currGrid = null; let currGrid = null;
/**
* Called by tests to enable the grid layout.
*/
function enableGridLayoutForTesting() {
isGridEnabled = true;
document.body.classList.add(CLASSES.GRID_LAYOUT);
}
/** /**
* Additional API for Array. Moves the item at index |from| to index |to|. * Additional API for Array. Moves the item at index |from| to index |to|.
* @param {number} from Index of the item to move. * @param {number} from Index of the item to move.
...@@ -546,7 +516,7 @@ class Grid { ...@@ -546,7 +516,7 @@ class Grid {
this.newIndexOfItemToReorder_ = index; this.newIndexOfItemToReorder_ = index;
// Apply reorder styling. // Apply reorder styling.
tile.classList.add(CLASSES.GRID_REORDER); tile.classList.add(CLASSES.REORDER);
// Disable other hover/active styling for all tiles. // Disable other hover/active styling for all tiles.
document.body.classList.add(CLASSES.REORDERING); document.body.classList.add(CLASSES.REORDERING);
...@@ -598,7 +568,7 @@ class Grid { ...@@ -598,7 +568,7 @@ class Grid {
const index = Number(tile.getAttribute('index')); const index = Number(tile.getAttribute('index'));
// Remove reorder styling. // Remove reorder styling.
tile.classList.remove(CLASSES.GRID_REORDER); tile.classList.remove(CLASSES.REORDER);
document.body.classList.remove(CLASSES.REORDERING); document.body.classList.remove(CLASSES.REORDERING);
// Move the tile to its new position and notify EmbeddedSearchAPI that the // Move the tile to its new position and notify EmbeddedSearchAPI that the
...@@ -623,7 +593,7 @@ class Grid { ...@@ -623,7 +593,7 @@ class Grid {
reorderToIndexAtPoint_(x, y) { reorderToIndexAtPoint_(x, y) {
const elements = document.elementsFromPoint(x, y); const elements = document.elementsFromPoint(x, y);
for (let i = 0; i < elements.length; i++) { for (let i = 0; i < elements.length; i++) {
if (elements[i].classList.contains('grid-tile-container') && if (elements[i].classList.contains(CLASSES.GRID_TILE_CONTAINER) &&
elements[i].getAttribute('index') !== null) { elements[i].getAttribute('index') !== null) {
this.reorderToIndex_(Number(elements[i].getAttribute('index'))); this.reorderToIndex_(Number(elements[i].getAttribute('index')));
return; return;
...@@ -936,18 +906,9 @@ function swapInNewTiles() { ...@@ -936,18 +906,9 @@ function swapInNewTiles() {
cur.id = IDS.MV_TILES; cur.id = IDS.MV_TILES;
parent.appendChild(cur); parent.appendChild(cur);
if (isGridEnabled) { // Initialize the new tileset before modifying opacity. This will prevent the
// Initialize the new tileset before modifying opacity. This will prevent // transform transition from applying after the tiles fade in.
// the transform transition from applying after the tiles fade in. currGrid.init(cur);
currGrid.init(cur);
} else {
// Re-balance the tiles if there are more than |MD_MAX_TILES_PER_ROW| in
// order to make even rows.
if (cur.childNodes.length > MD_MAX_TILES_PER_ROW) {
cur.style.maxWidth = 'calc(var(--md-tile-size) * ' +
Math.ceil(cur.childNodes.length / 2) + ')';
}
}
const flushOpacity = () => window.getComputedStyle(cur).opacity; const flushOpacity = () => window.getComputedStyle(cur).opacity;
...@@ -1036,80 +997,6 @@ function editCustomLink(rid) { ...@@ -1036,80 +997,6 @@ function editCustomLink(rid) {
window.parent.postMessage({cmd: 'startEditLink', rid: rid}, DOMAIN_ORIGIN); window.parent.postMessage({cmd: 'startEditLink', rid: rid}, DOMAIN_ORIGIN);
} }
/**
* Starts the reorder flow. Updates the visual style of the held tile to
* indicate that it is being moved.
* @param {!Element} tile Tile that is being moved.
*/
function startReorder(tile) {
reordering = true;
elementToReorder = tile;
tile.classList.add(CLASSES.REORDER);
// Disable other hover/active styling for all tiles.
document.body.classList.add(CLASSES.REORDERING);
document.addEventListener('dragend', () => {
stopReorder(tile);
}, {once: true});
}
/**
* Stops the reorder flow. Resets the held tile's visual style and tells the
* EmbeddedSearchAPI that a tile has been moved.
* @param {!Element} tile Tile that has been moved.
*/
function stopReorder(tile) {
reordering = false;
elementToReorder = null;
tile.classList.remove(CLASSES.REORDER);
document.body.classList.remove(CLASSES.REORDERING);
// Update |data-pos| for all tiles and notify EmbeddedSearchAPI that the tile
// has been moved.
const allTiles = document.querySelectorAll('#mv-tiles .' + CLASSES.MD_TILE);
for (let i = 0; i < allTiles.length; i++) {
allTiles[i].setAttribute('data-pos', i);
}
chrome.embeddedSearch.newTabPage.reorderCustomLink(
Number(tile.getAttribute('data-rid')),
Number(tile.getAttribute('data-pos')));
}
/**
* Sets up event listeners necessary for tile reordering.
* @param {!Element} tile Tile on which to set the event listeners.
*/
function setupReorder(tile) {
// Starts the reorder flow.
tile.addEventListener('dragstart', (event) => {
if (!reordering) {
startReorder(tile);
}
});
tile.addEventListener('dragover', (event) => {
// Only executed when the reorder flow is ongoing. Inserts the tile that is
// being moved before/after this |tile| according to order in the list.
if (reordering && elementToReorder && elementToReorder != tile) {
// Determine which side to insert the element on:
// - If the held tile comes after the current tile, insert behind the
// current tile.
// - If the held tile comes before the current tile, insert in front of
// the current tile.
let insertBefore; // Element to insert the held tile behind.
if (tile.compareDocumentPosition(elementToReorder) &
Node.DOCUMENT_POSITION_FOLLOWING) {
insertBefore = tile;
} else {
insertBefore = tile.nextSibling;
}
$('mv-tiles').insertBefore(elementToReorder, insertBefore);
}
});
}
/** /**
* Renders a MostVisited tile (i.e. shortcut) to the DOM. * Renders a MostVisited tile (i.e. shortcut) to the DOM.
* @param {!MostVisitedData} data Object containing rid, url, title, favicon, * @param {!MostVisitedData} data Object containing rid, url, title, favicon,
...@@ -1273,16 +1160,7 @@ function renderTile(data) { ...@@ -1273,16 +1160,7 @@ function renderTile(data) {
mdTile.appendChild(mdMenu); mdTile.appendChild(mdMenu);
} }
if (isGridEnabled) { return currGrid.createGridTile(mdTile, data.rid, !!data.isAddButton);
return currGrid.createGridTile(mdTile, data.rid, !!data.isAddButton);
} else {
// Enable reordering.
if (isCustomLinksEnabled() && !data.isAddButton) {
mdTile.draggable = 'true';
setupReorder(mdTile);
}
return mdTile;
}
} }
/** /**
...@@ -1318,12 +1196,6 @@ function init() { ...@@ -1318,12 +1196,6 @@ function init() {
customLinksFeatureEnabled = true; customLinksFeatureEnabled = true;
} }
// Enable grid layout.
if (queryArgs['enableGrid'] == '1') {
isGridEnabled = true;
document.body.classList.add(CLASSES.GRID_LAYOUT);
}
currGrid = new Grid(); currGrid = new Grid();
// Set up layout updates on window resize. Throttled according to // Set up layout updates on window resize. Throttled according to
// |RESIZE_TIMEOUT_DELAY|. // |RESIZE_TIMEOUT_DELAY|.
...@@ -1334,11 +1206,7 @@ function init() { ...@@ -1334,11 +1206,7 @@ function init() {
} }
resizeTimeout = window.setTimeout(() => { resizeTimeout = window.setTimeout(() => {
resizeTimeout = null; resizeTimeout = null;
if (isGridEnabled) { currGrid.onResize();
currGrid.onResize();
} else {
updateTileVisibility();
}
}, RESIZE_TIMEOUT_DELAY); }, RESIZE_TIMEOUT_DELAY);
}; };
...@@ -1355,7 +1223,6 @@ function listen() { ...@@ -1355,7 +1223,6 @@ function listen() {
return { return {
Grid: Grid, // Exposed for testing. Grid: Grid, // Exposed for testing.
init: init, // Exposed for testing. init: init, // Exposed for testing.
enableGridLayoutForTesting: enableGridLayoutForTesting,
listen: listen, listen: listen,
}; };
} }
......
...@@ -610,9 +610,6 @@ class LocalNtpSource::SearchConfigurationProvider ...@@ -610,9 +610,6 @@ class LocalNtpSource::SearchConfigurationProvider
->IsAccessibleBrowser()); ->IsAccessibleBrowser());
if (is_google) { if (is_google) {
config_data.SetBoolean(
"enableShortcutsGrid",
base::FeatureList::IsEnabled(features::kGridLayoutForNtpShortcuts));
config_data.SetBoolean( config_data.SetBoolean(
"richerPicker", "richerPicker",
base::FeatureList::IsEnabled(features::kNtpCustomizationMenuV2)); base::FeatureList::IsEnabled(features::kNtpCustomizationMenuV2));
......
...@@ -20,11 +20,6 @@ const base::Feature kChromeColors{"ChromeColors", ...@@ -20,11 +20,6 @@ const base::Feature kChromeColors{"ChromeColors",
const base::Feature kChromeColorsCustomColorPicker{ const base::Feature kChromeColorsCustomColorPicker{
"ChromeColorsCustomColorPicker", base::FEATURE_DISABLED_BY_DEFAULT}; "ChromeColorsCustomColorPicker", base::FEATURE_DISABLED_BY_DEFAULT};
// If enabled, the NTP shortcut layout will be replaced with a grid layout that
// enables better animations.
const base::Feature kGridLayoutForNtpShortcuts{
"GridLayoutForNtpShortcuts", base::FEATURE_ENABLED_BY_DEFAULT};
// If enabled, the user will see the second version of the customization picker. // If enabled, the user will see the second version of the customization picker.
const base::Feature kNtpCustomizationMenuV2{"NtpCustomizationMenuV2", const base::Feature kNtpCustomizationMenuV2{"NtpCustomizationMenuV2",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -14,7 +14,6 @@ namespace features { ...@@ -14,7 +14,6 @@ namespace features {
extern const base::Feature kChromeColors; extern const base::Feature kChromeColors;
extern const base::Feature kChromeColorsCustomColorPicker; extern const base::Feature kChromeColorsCustomColorPicker;
extern const base::Feature kGridLayoutForNtpShortcuts;
extern const base::Feature kNtpCustomizationMenuV2; extern const base::Feature kNtpCustomizationMenuV2;
// Note: only exposed for about:flags. Use IsNtpRealboxEnabled() instead. // Note: only exposed for about:flags. Use IsNtpRealboxEnabled() instead.
......
...@@ -25,7 +25,7 @@ test.mostVisited.MOST_VISITED = 'most-visited'; ...@@ -25,7 +25,7 @@ test.mostVisited.MOST_VISITED = 'most-visited';
test.mostVisited.CLASSES = { test.mostVisited.CLASSES = {
GRID_TILE: 'grid-tile', GRID_TILE: 'grid-tile',
GRID_TILE_CONTAINER: 'grid-tile-container', GRID_TILE_CONTAINER: 'grid-tile-container',
GRID_REORDER: 'grid-reorder', REORDER: 'reorder',
REORDERING: 'reordering', REORDERING: 'reordering',
}; };
...@@ -79,7 +79,6 @@ test.mostVisited.setUp = function() { ...@@ -79,7 +79,6 @@ test.mostVisited.setUp = function() {
}); });
test.mostVisited.mostvisited = test.mostVisited.init(); test.mostVisited.mostvisited = test.mostVisited.init();
test.mostVisited.mostvisited.enableGridLayoutForTesting();
test.mostVisited.grid = new test.mostVisited.mostvisited.Grid(); test.mostVisited.grid = new test.mostVisited.mostvisited.Grid();
}; };
...@@ -375,21 +374,21 @@ test.mostVisited.testReorderStart = function() { ...@@ -375,21 +374,21 @@ test.mostVisited.testReorderStart = function() {
assertEquals(i, Number(tile.getAttribute('rid'))); assertEquals(i, Number(tile.getAttribute('rid')));
assertTrue(tile.firstChild.draggable); assertTrue(tile.firstChild.draggable);
assertFalse(tile.classList.contains(test.mostVisited.CLASSES.GRID_REORDER)); assertFalse(tile.classList.contains(test.mostVisited.CLASSES.REORDER));
assertFalse( assertFalse(
document.body.classList.contains(test.mostVisited.CLASSES.REORDERING)); document.body.classList.contains(test.mostVisited.CLASSES.REORDERING));
// Start the reorder flow. // Start the reorder flow.
tile.firstChild.dispatchEvent(dragStart); tile.firstChild.dispatchEvent(dragStart);
assertTrue(tile.classList.contains(test.mostVisited.CLASSES.GRID_REORDER)); assertTrue(tile.classList.contains(test.mostVisited.CLASSES.REORDER));
assertTrue( assertTrue(
document.body.classList.contains(test.mostVisited.CLASSES.REORDERING)); document.body.classList.contains(test.mostVisited.CLASSES.REORDERING));
// Stop the reorder flow. // Stop the reorder flow.
document.dispatchEvent(dragEnd); document.dispatchEvent(dragEnd);
assertFalse(tile.classList.contains(test.mostVisited.CLASSES.GRID_REORDER)); assertFalse(tile.classList.contains(test.mostVisited.CLASSES.REORDER));
assertFalse( assertFalse(
document.body.classList.contains(test.mostVisited.CLASSES.REORDERING)); document.body.classList.contains(test.mostVisited.CLASSES.REORDERING));
} }
...@@ -400,8 +399,7 @@ test.mostVisited.testReorderStart = function() { ...@@ -400,8 +399,7 @@ test.mostVisited.testReorderStart = function() {
assertFalse(addButton.firstChild.draggable); assertFalse(addButton.firstChild.draggable);
addButton.firstChild.dispatchEvent(dragStart); addButton.firstChild.dispatchEvent(dragStart);
assertFalse( assertFalse(addButton.classList.contains(test.mostVisited.CLASSES.REORDER));
addButton.classList.contains(test.mostVisited.CLASSES.GRID_REORDER));
assertFalse( assertFalse(
document.body.classList.contains(test.mostVisited.CLASSES.REORDERING)); document.body.classList.contains(test.mostVisited.CLASSES.REORDERING));
}; };
...@@ -436,7 +434,7 @@ test.mostVisited.testReorderStartTouch = function() { ...@@ -436,7 +434,7 @@ test.mostVisited.testReorderStartTouch = function() {
assertEquals('false', tile.getAttribute('add')); assertEquals('false', tile.getAttribute('add'));
assertEquals(0, Number(tile.getAttribute('rid'))); assertEquals(0, Number(tile.getAttribute('rid')));
assertFalse(tile.classList.contains(test.mostVisited.CLASSES.GRID_REORDER)); assertFalse(tile.classList.contains(test.mostVisited.CLASSES.REORDER));
assertFalse( assertFalse(
document.body.classList.contains(test.mostVisited.CLASSES.REORDERING)); document.body.classList.contains(test.mostVisited.CLASSES.REORDERING));
...@@ -444,14 +442,14 @@ test.mostVisited.testReorderStartTouch = function() { ...@@ -444,14 +442,14 @@ test.mostVisited.testReorderStartTouch = function() {
tile.firstChild.dispatchEvent(touchStart); tile.firstChild.dispatchEvent(touchStart);
tile.firstChild.dispatchEvent(touchMove); tile.firstChild.dispatchEvent(touchMove);
assertTrue(tile.classList.contains(test.mostVisited.CLASSES.GRID_REORDER)); assertTrue(tile.classList.contains(test.mostVisited.CLASSES.REORDER));
assertTrue( assertTrue(
document.body.classList.contains(test.mostVisited.CLASSES.REORDERING)); document.body.classList.contains(test.mostVisited.CLASSES.REORDERING));
// Stop the reorder flow. // Stop the reorder flow.
tile.firstChild.dispatchEvent(touchEnd); tile.firstChild.dispatchEvent(touchEnd);
assertFalse(tile.classList.contains(test.mostVisited.CLASSES.GRID_REORDER)); assertFalse(tile.classList.contains(test.mostVisited.CLASSES.REORDER));
assertFalse( assertFalse(
document.body.classList.contains(test.mostVisited.CLASSES.REORDERING)); document.body.classList.contains(test.mostVisited.CLASSES.REORDERING));
...@@ -461,8 +459,7 @@ test.mostVisited.testReorderStartTouch = function() { ...@@ -461,8 +459,7 @@ test.mostVisited.testReorderStartTouch = function() {
addButton.firstChild.dispatchEvent(touchStart); addButton.firstChild.dispatchEvent(touchStart);
addButton.firstChild.dispatchEvent(touchMove); addButton.firstChild.dispatchEvent(touchMove);
assertFalse( assertFalse(addButton.classList.contains(test.mostVisited.CLASSES.REORDER));
addButton.classList.contains(test.mostVisited.CLASSES.GRID_REORDER));
assertFalse( assertFalse(
document.body.classList.contains(test.mostVisited.CLASSES.REORDERING)); document.body.classList.contains(test.mostVisited.CLASSES.REORDERING));
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment