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

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: Fix supervised user test. 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 element;
9 var element = document.createElement('history-card'); 9
10 suiteSetup(function() {
11 element = document.createElement('history-card');
10 element.historyItems = [ 12 element.historyItems = [
11 {"time": "1000000000"}, 13 {"time": "1000000000"},
12 {"time": "10000000"}, 14 {"time": "10000000"},
13 {"time": "900000"} 15 {"time": "900000"}
14 ]; 16 ];
17 })
18
19 test('basic separator insertion', function(done) {
15 flush(function() { 20 flush(function() {
16 // Check that the correct number of time gaps are inserted. 21 // Check that the correct number of time gaps are inserted.
17 var spacers = 22 var spacers =
18 Polymer.dom(element.root).querySelectorAll('#time-gap-separator'); 23 Polymer.dom(element.root).querySelectorAll('#time-gap-separator');
19 assertEquals(2, spacers.length); 24 assertEquals(2, spacers.length);
20 done(); 25 done();
21 }); 26 });
22 }); 27 });
28
29 test('separator insertion when items change but item list length stays ' +
30 'the same', function(done) {
31 element.set('historyItems', [{"time": "900000"},
32 {"time": "900000"},
33 {"time": "900000"}]);
34
35 flush(function() {
36 var items =
37 Polymer.dom(element.root).querySelectorAll('history-item');
38 var spacers =
39 Polymer.dom(element.root).querySelectorAll('#time-gap-separator');
40
41 assertEquals('900000', items[0].timestamp_);
42 assertEquals('900000', items[1].timestamp_);
43 assertEquals('900000', items[2].timestamp_);
44
45 // Note that the spacers aren't actually removed, are just set to:
46 // display: none;
47 for (var i = 0; i < spacers.length; i++) {
48 assertEquals(spacers[i].style.display, 'none');
49 }
50 done();
51 });
52 });
23 }); 53 });
24 } 54 }
25 return { 55 return {
26 registerTests: registerTests 56 registerTests: registerTests
27 }; 57 };
28 }); 58 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698