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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('md_history.history_toolbar_test', function() {
6 // Array of test history data.
7 var TEST_HISTORY_RESULTS = [
8 {
9 "dateRelativeDay": "Today - Wednesday, December 9, 2015",
10 "url": "https://www.google.com"
11 }
12 ];
13
14 function registerTests() {
15 suite('history-toolbar', function() {
16 var element;
17 var toolbar;
18
19 suiteSetup(function() {
20 element = $('history-card-manager');
21 toolbar = $('toolbar');
22 });
23
24 test('selecting checkbox causes toolbar to change', function() {
25 element.addNewResults(TEST_HISTORY_RESULTS);
26
27 flush(function() {
28 var item = element.$$('history-card').$$('history-item');
29 MockInteractions.tap(item.$['checkbox']);
tsergeant 2016/01/25 00:40:20 item.$.checkbox here and below again
hsampson 2016/01/25 02:14:01 Done.
30
31 // Ensure that when an item is selected that the count held by the
32 // toolbar increases.
33 assertEquals(1, toolbar.count);
34 // Ensure that the toolbar boolean states that at least one item is
35 // selected.
36 assertTrue(toolbar.itemsSelected_);
37
38 MockInteractions.tap(item.$['checkbox']);
39
40 // Ensure that when an item is deselected the count held by the
41 // toolbar decreases.
42 assertEquals(0, toolbar.count);
43 // Ensure that the toolbar boolean states that no items are selected.
44 assertFalse(toolbar.itemsSelected_);
45 });
46 });
47
48 teardown(function() {
49 toolbar.count = 0;
50 });
51 });
52 }
53 return {
54 registerTests: registerTests
55 };
56 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698