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

Side by Side Diff: chrome/test/data/webui/settings/settings_ui_browsertest.js

Issue 2465433002: Create implementation of the side panel using a dialog. (Closed)
Patch Set: Address feedback. Created 4 years 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 /** @fileoverview Suite of tests for the Settings layout. */ 5 /** @fileoverview Suite of tests for the Settings layout. */
6 6
7 GEN_INCLUDE(['settings_page_browsertest.js']); 7 GEN_INCLUDE(['settings_page_browsertest.js']);
8 8
9 /** 9 /**
10 * @constructor 10 * @constructor
(...skipping 29 matching lines...) Expand all
40 Polymer.dom.flush(); 40 Polymer.dom.flush();
41 }); 41 });
42 42
43 test('basic', function() { 43 test('basic', function() {
44 toolbar = assert(ui.$$('cr-toolbar')); 44 toolbar = assert(ui.$$('cr-toolbar'));
45 assertTrue(toolbar.showMenu); 45 assertTrue(toolbar.showMenu);
46 }); 46 });
47 47
48 test('app drawer', function(done) { 48 test('app drawer', function(done) {
49 assertEquals(null, ui.$$('settings-menu')); 49 assertEquals(null, ui.$$('settings-menu'));
50 var drawer = assert(ui.$$('app-drawer')); 50 var drawer = ui.$.drawer;
51 assertFalse(drawer.opened); 51 assertFalse(!!drawer.open);
52 52
53 // Slide the drawer partway open. (These events are copied from Polymer's 53 drawer.openDrawer();
54 // app-drawer tests.)
55 drawer.fire('track', {state: 'start'});
56 drawer.fire('track', {state: 'track', dx: 10, ddx: 10});
57 drawer.fire('track', {state: 'end', dx: 10, ddx: 0});
58 54
59 // Menu is rendered asynchronously, but the drawer stays closed.
60 Polymer.dom.flush(); 55 Polymer.dom.flush();
61 assertFalse(drawer.opened); 56 // Validate that dialog is open and menu is shown so it will animate.
57 assertTrue(drawer.open);
62 assertTrue(!!ui.$$('settings-menu')); 58 assertTrue(!!ui.$$('settings-menu'));
63 59
64 // Slide most of the way open. 60 // Close the dialog after it fully opens.
65 drawer.fire('track', {state: 'start'}); 61 drawer.addEventListener('open', function() {
66 drawer.fire('track', {state: 'track', dx: 200, ddx: 200}); 62 // Click away from the drawer.
67 drawer.fire('track', {state: 'end', dx: 200, ddx: 0}); 63 // MockInteractions don't expose a way to click at a specific location.
64 var midScreen = MockInteractions.middleOfNode(ui);
65 drawer.dispatchEvent(new MouseEvent('click', {
66 'bubbles': true,
67 'concelable': true,
68 'clientX': midScreen.x,
69 'clientY': midScreen.y,
70 }));
71 });
68 72
69 // Drawer is shown. 73 drawer.addEventListener('close', function() {
70 Polymer.dom.flush();
71 assertTrue(drawer.opened);
72
73 // Click away from the drawer.
74 MockInteractions.tap(drawer.$.scrim);
75 Polymer.Base.async(function() {
76 // Drawer is closed, but menu is still stamped so its contents remain 74 // Drawer is closed, but menu is still stamped so its contents remain
77 // visible as the drawer slides out. 75 // visible as the drawer slides out.
78 assertFalse(drawer.opened); 76 assertFalse(drawer.open);
79 assertTrue(!!ui.$$('settings-menu')); 77 assertTrue(!!ui.$$('settings-menu'));
80 done(); 78 done();
81 }); 79 });
82 }); 80 });
83 81
84 test('advanced UIs stay in sync', function() { 82 test('advanced UIs stay in sync', function() {
85 var main = ui.$$('settings-main'); 83 var main = ui.$$('settings-main');
86 assertTrue(!!main); 84 assertTrue(!!main);
87 85
88 assertFalse(!!ui.$$('settings-menu')); 86 assertFalse(!!ui.$$('settings-menu'));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 assertEquals('foo ', urlParams.get('search')); 154 assertEquals('foo ', urlParams.get('search'));
157 155
158 searchField.setValue(' '); 156 searchField.setValue(' ');
159 urlParams = settings.getQueryParameters(); 157 urlParams = settings.getQueryParameters();
160 assertFalse(urlParams.has('search')); 158 assertFalse(urlParams.has('search'));
161 }); 159 });
162 }); 160 });
163 161
164 mocha.run(); 162 mocha.run();
165 }); 163 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698