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

Unified Diff: chrome/test/data/webui/md_history/history_item_test.js

Issue 1641543002: MD History: Refactored design for displaying history information (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@second_patch
Patch Set: Rebase + reply to comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/md_history/history_item_test.js
diff --git a/chrome/test/data/webui/md_history/history_card_test.js b/chrome/test/data/webui/md_history/history_item_test.js
similarity index 36%
copy from chrome/test/data/webui/md_history/history_card_test.js
copy to chrome/test/data/webui/md_history/history_item_test.js
index af661a256bd892e47f5a605f7b1556f6f939eb77..2f92b22bdc32f6482c318e74947d88c02234ed6d 100644
--- a/chrome/test/data/webui/md_history/history_card_test.js
+++ b/chrome/test/data/webui/md_history/history_item_test.js
@@ -2,19 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('md_history.history_card_test', function() {
+cr.define('md_history.history_item_test', function() {
+ var TEST_HISTORY_RESULTS = [
+ {"time": "1000000000"},
+ {"time": "10000000"},
+ {"time": "900000"},
+ {"time": "899999"}
+ ];
+
function registerTests() {
- suite('history-card', function() {
+ suite('history-item', function() {
var element;
suiteSetup(function() {
- element = document.createElement('history-card');
- element.historyItems = [
- {"time": "1000000000"},
- {"time": "10000000"},
- {"time": "900000"}
- ];
- })
+ element = $('history-list');
+ });
+
+ setup(function() {
+ element.addNewResults(TEST_HISTORY_RESULTS);
+ });
test('basic separator insertion', function(done) {
flush(function() {
@@ -22,34 +28,21 @@ cr.define('md_history.history_card_test', function() {
var spacers =
Polymer.dom(element.root).querySelectorAll('#time-gap-separator');
assertEquals(2, spacers.length);
- done();
- });
- });
-
- test('separator insertion when items change but item list length stays ' +
- 'the same', function(done) {
- element.set('historyItems', [{"time": "900000"},
- {"time": "900000"},
- {"time": "900000"}]);
- flush(function() {
var items =
- Polymer.dom(element.root).querySelectorAll('history-item');
- var spacers =
- Polymer.dom(element.root).querySelectorAll('#time-gap-separator');
+ Polymer.dom(element.root).querySelectorAll('history-item');
- assertEquals('900000', items[0].timestamp_);
- assertEquals('900000', items[1].timestamp_);
- assertEquals('900000', items[2].timestamp_);
+ assertTrue(items[0].hasTimeGap);
+ assertTrue(items[1].hasTimeGap);
+ assertFalse(items[2].hasTimeGap);
- // Note that the spacers aren't actually removed, are just set to:
- // display: none;
- for (var i = 0; i < spacers.length; i++) {
- assertEquals(spacers[i].style.display, 'none');
- }
done();
});
});
+
+ teardown(function() {
+ element.historyData = [];
+ });
});
}
return {

Powered by Google App Engine
This is Rietveld 408576698