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

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

Issue 1572383006: MD History: Hook all elements into the page and add tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch
Patch Set: Address reviewer comments. Created 4 years, 11 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_toolbar_test.js
diff --git a/chrome/test/data/webui/md_history/history_toolbar_test.js b/chrome/test/data/webui/md_history/history_toolbar_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..8888857efdb7ff8f01199dccb64dfc46023d9401
--- /dev/null
+++ b/chrome/test/data/webui/md_history/history_toolbar_test.js
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// 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_toolbar_test', function() {
+ // Array of test history data.
+ var TEST_HISTORY_RESULTS = [
+ {
+ "dateRelativeDay": "Today - Wednesday, December 9, 2015",
+ "url": "https://www.google.com"
+ }
+ ];
+
+ function registerTests() {
+ suite('history-toolbar', function() {
+ var element;
+ var toolbar;
+
+ suiteSetup(function() {
+ element = $('history-card-manager');
+ toolbar = $('toolbar');
+ });
+
+ test('selecting checkbox causes toolbar to change', function() {
+ element.addNewResults(TEST_HISTORY_RESULTS);
+
+ flush(function() {
+ var item = element.$$('history-card').$$('history-item');
+ MockInteractions.tap(item.$['checkbox']);
+
+ // Ensure that when an item is selected that the count held by the
+ // toolbar increases.
+ assertEquals(1, toolbar.count);
+ // Ensure that the toolbar boolean states that at least one item is
+ // selected.
+ assertTrue(toolbar.itemsSelected_);
+
+ MockInteractions.tap(item.$['checkbox']);
+
+ // Ensure that when an item is deselected that the count held by the
tsergeant 2016/01/22 02:37:11 Nit: probably remove the extra 'that' // Ensure t
hsampson 2016/01/22 05:05:03 Done.
+ // toolbar decreases.
+ assertEquals(0, toolbar.count);
+ // Ensure that the toolbar boolean states that no items are selected.
+ assertFalse(toolbar.itemsSelected_);
+ });
+ });
+
+ teardown(function() {
+ toolbar.count = 0;
+ });
+ });
+ }
+ return {
+ registerTests: registerTests
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698