Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: chrome/test/data/webui/md_bookmarks/reducers_test.js

Issue 2799653003: MD Bookmarks: Implement 'Sort by Title' menu button (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/md_bookmarks/toolbar.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 suite('selection state', function() { 5 suite('selection state', function() {
6 var state; 6 var state;
7 var action; 7 var action;
8 8
9 function select(items, anchor, add) { 9 function select(items, anchor, add) {
10 return { 10 return {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 334
335 assertDeepEquals(['2', '4', '3'], state['1'].children); 335 assertDeepEquals(['2', '4', '3'], state['1'].children);
336 336
337 // Move between different folders. 337 // Move between different folders.
338 action = bookmarks.actions.moveBookmark('4', '5', 0, '1', 1); 338 action = bookmarks.actions.moveBookmark('4', '5', 0, '1', 1);
339 state = bookmarks.NodeState.updateNodes(state, action); 339 state = bookmarks.NodeState.updateNodes(state, action);
340 340
341 assertDeepEquals(['2', '3'], state['1'].children); 341 assertDeepEquals(['2', '3'], state['1'].children);
342 assertDeepEquals(['4'], state['5'].children); 342 assertDeepEquals(['4'], state['5'].children);
343 }); 343 });
344
345 test('updates when children of a node are reordered', function() {
346 action = bookmarks.actions.reorderChildren('1', ['4', '2', '3']);
347 state = bookmarks.NodeState.updateNodes(state, action);
348
349 assertDeepEquals(['4', '2', '3'], state['1'].children);
350 });
344 }); 351 });
345 352
346 suite('search state', function() { 353 suite('search state', function() {
347 var state; 354 var state;
348 355
349 setup(function() { 356 setup(function() {
350 // Search touches a few different things, so we test using the entire state: 357 // Search touches a few different things, so we test using the entire state:
351 state = bookmarks.util.createEmptyState(); 358 state = bookmarks.util.createEmptyState();
352 state.nodes = testTree(createFolder('1', [ 359 state.nodes = testTree(createFolder('1', [
353 createFolder( 360 createFolder(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 state = bookmarks.reduceAction(state, action); 420 state = bookmarks.reduceAction(state, action);
414 421
415 action = bookmarks.actions.removeBookmark('2', '1', 0, state.nodes); 422 action = bookmarks.actions.removeBookmark('2', '1', 0, state.nodes);
416 state = bookmarks.reduceAction(state, action); 423 state = bookmarks.reduceAction(state, action);
417 424
418 // 2 and 3 should be removed, since 2 was deleted and 3 was a descendant of 425 // 2 and 3 should be removed, since 2 was deleted and 3 was a descendant of
419 // 2. 426 // 2.
420 assertDeepEquals(['1'], state.search.results); 427 assertDeepEquals(['1'], state.search.results);
421 }); 428 });
422 }); 429 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/toolbar.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698