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

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: 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('transitionend', function() {
66 drawer.fire('track', {state: 'track', dx: 200, ddx: 200}); 62 if (drawer.classList.contains('opening')) {
67 drawer.fire('track', {state: 'end', dx: 200, ddx: 0}); 63 // Click away from the drawer. MockInteractions don't expose a way to
64 // click at a specific location.
65 var midScreen = MockInteractions.middleOfNode(ui);
66 drawer.dispatchEvent(new MouseEvent('click', {
67 'bubbles': true,
68 'concelable': true,
dpapad 2016/12/09 18:57:53 s/concelable/cancelable
hcarmona 2016/12/09 19:21:26 Done.
69 'clientX': midScreen.x,
70 'clientY': midScreen.y,
71 }));
72 }
73 });
68 74
69 // Drawer is shown. 75 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 76 // Drawer is closed, but menu is still stamped so its contents remain
77 // visible as the drawer slides out. 77 // visible as the drawer slides out.
78 assertFalse(drawer.opened); 78 assertFalse(drawer.open);
79 assertTrue(!!ui.$$('settings-menu')); 79 assertTrue(!!ui.$$('settings-menu'));
80 done(); 80 done();
81 }); 81 });
82 }); 82 });
83 83
84 test('advanced UIs stay in sync', function() { 84 test('advanced UIs stay in sync', function() {
85 var main = ui.$$('settings-main'); 85 var main = ui.$$('settings-main');
86 assertTrue(!!main); 86 assertTrue(!!main);
87 87
88 assertFalse(!!ui.$$('settings-menu')); 88 assertFalse(!!ui.$$('settings-menu'));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 assertEquals('foo ', urlParams.get('search')); 156 assertEquals('foo ', urlParams.get('search'));
157 157
158 searchField.setValue(' '); 158 searchField.setValue(' ');
159 urlParams = settings.getQueryParameters(); 159 urlParams = settings.getQueryParameters();
160 assertFalse(urlParams.has('search')); 160 assertFalse(urlParams.has('search'));
161 }); 161 });
162 }); 162 });
163 163
164 mocha.run(); 164 mocha.run();
165 }); 165 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698