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

Side by Side Diff: chrome/test/data/webui/cr_elements/cr_drawer_tests.js

Issue 2628123002: MD WebUI: Move settings' dialog-drawer element into a shared cr-element (Closed)
Patch Set: Add test Created 3 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 2017 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 suite('cr-drawer', function() {
dpapad 2017/01/12 22:38:57 BTW, thanks for adding tests!
tsergeant 2017/01/12 22:53:51 No problem! I figured the existing test is pretty
6 var drawer;
7
8 setup(function() {
9 PolymerTest.clearBody();
10 document.body.innerHTML = `
11 <dialog is="cr-drawer" id="drawer">
12 <div class="drawer-header">Test</div>
13 <div class="drawer-content">Test content</div>
14 </dialog>
15 `;
16
17 drawer = document.getElementById('drawer');
18 });
19
20 test('open and close', function(done) {
21 drawer.openDrawer();
22 assertTrue(drawer.open);
23
24 listenOnce(drawer, 'transitionend', function() {
25 listenOnce(drawer, 'close', function() {
26 assertFalse(drawer.open);
27 done();
28 });
29
30 // Clicking the content does not close the drawer.
31 MockInteractions.tap(document.querySelector('.drawer-content'));
32 assertFalse(drawer.classList.contains('closing'));
33
34 drawer.dispatchEvent(new MouseEvent('click', {
35 bubbles: true,
36 cancelable: true,
37 clientX: 300, // Must be larger than the drawer width (256px).
38 clientY: 300,
39 }));
40
41 // Clicking outside the drawer does close it.
42 assertTrue(drawer.classList.contains('closing'));
43 });
44 });
45 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698