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

Side by Side Diff: chrome/test/data/webui/md_history/history_card_test.js

Issue 1586373002: MD History: Delete button in the toolbar allows deletion of multiple history-items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch_to_be_uploaded
Patch Set: Address reviewer comments and rebase. Created 4 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 cr.define('md_history.history_card_test', function() { 5 cr.define('md_history.history_card_test', function() {
6 function registerTests() { 6 function registerTests() {
7 suite('history-card', function() { 7 suite('history-card', function() {
8 test('basic separator insertion', function(done) { 8 var spacers;
9 var element = document.createElement('history-card'); 9 var element;
10 var items;
calamity 2016/02/04 23:59:52 nit: remove spacers and items from here and just h
11
12 suiteSetup(function() {
13 element = document.createElement('history-card');
10 element.historyItems = [ 14 element.historyItems = [
11 {"time": "1000000000"}, 15 {"time": "1000000000"},
12 {"time": "10000000"}, 16 {"time": "10000000"},
13 {"time": "900000"} 17 {"time": "900000"}
14 ]; 18 ];
19 })
20
21 test('basic separator insertion', function(done) {
15 flush(function() { 22 flush(function() {
16 // Check that the correct number of time gaps are inserted. 23 // Check that the correct number of time gaps are inserted.
17 var spacers = 24 spacers =
18 Polymer.dom(element.root).querySelectorAll('#time-gap-separator'); 25 Polymer.dom(element.root).querySelectorAll('#time-gap-separator');
19 assertEquals(2, spacers.length); 26 assertEquals(2, spacers.length);
20 done(); 27 done();
21 }); 28 });
22 }); 29 });
30
31 test('separator insertion when items change but card stays the same',
calamity 2016/02/04 23:59:52 'but item list length stays the same'
32 function(done) {
33 element.set('historyItems', [{"time": "900000"},
34 {"time": "900000"},
35 {"time": "900000"}]);
36
37 flush(function() {
38 items = Polymer.dom(element.root).querySelectorAll('history-item');
39 spacers =
40 Polymer.dom(element.root).querySelectorAll('#time-gap-separator');
41
42 assertEquals('900000', items[0].timestamp_);
43 assertEquals('900000', items[1].timestamp_);
44 assertEquals('900000', items[2].timestamp_);
45
46 // Note that the spacers aren't actually removed, are just set to:
47 // display: none;
48 for (var i = 0; i < spacers.length; i++) {
49 assertEquals(spacers[i].style.display, 'none');
50 }
51 done();
52 });
53 });
54
55 teardown(function() {
56 spacers = [];
calamity 2016/02/04 23:59:52 You should be able to remove this.
57 });
23 }); 58 });
24 } 59 }
25 return { 60 return {
26 registerTests: registerTests 61 registerTests: registerTests
27 }; 62 };
28 }); 63 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698