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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/md_history/history_card_test.js
diff --git a/chrome/test/data/webui/md_history/history_card_test.js b/chrome/test/data/webui/md_history/history_card_test.js
index 25c5fa4a01159fcd97058215f08e070f88882d82..7ba30ac42af744bc66c541b13f92d23a5236c859 100644
--- a/chrome/test/data/webui/md_history/history_card_test.js
+++ b/chrome/test/data/webui/md_history/history_card_test.js
@@ -5,21 +5,56 @@
cr.define('md_history.history_card_test', function() {
function registerTests() {
suite('history-card', function() {
- test('basic separator insertion', function(done) {
- var element = document.createElement('history-card');
+ var spacers;
+ var element;
+ var items;
calamity 2016/02/04 23:59:52 nit: remove spacers and items from here and just h
+
+ suiteSetup(function() {
+ element = document.createElement('history-card');
element.historyItems = [
{"time": "1000000000"},
{"time": "10000000"},
{"time": "900000"}
];
+ })
+
+ test('basic separator insertion', function(done) {
flush(function() {
// Check that the correct number of time gaps are inserted.
- var spacers =
+ spacers =
Polymer.dom(element.root).querySelectorAll('#time-gap-separator');
assertEquals(2, spacers.length);
done();
});
});
+
+ 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'
+ function(done) {
+ element.set('historyItems', [{"time": "900000"},
+ {"time": "900000"},
+ {"time": "900000"}]);
+
+ flush(function() {
+ items = Polymer.dom(element.root).querySelectorAll('history-item');
+ spacers =
+ Polymer.dom(element.root).querySelectorAll('#time-gap-separator');
+
+ assertEquals('900000', items[0].timestamp_);
+ assertEquals('900000', items[1].timestamp_);
+ assertEquals('900000', items[2].timestamp_);
+
+ // 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() {
+ spacers = [];
calamity 2016/02/04 23:59:52 You should be able to remove this.
+ });
});
}
return {

Powered by Google App Engine
This is Rietveld 408576698