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

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

Issue 2106013002: Move settings-section animations into setting-section, make better (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Transitions
Patch Set: Computed properties Created 4 years, 5 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 /**
6 * @fileoverview Tests for settings.OpenSectionTransition and
7 * settings.CloseSectionTransition.
8 */
9
10 /** @const {string} Path to root from chrome/test/data/webui/settings/. */
11 var ROOT_PATH = '../../../../../';
12
13 // Polymer BrowserTest fixture.
14 GEN_INCLUDE(
15 [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']);
16
17 /**
18 * @constructor
19 * @extends PolymerTest
20 */
21 function SettingsOpenSectionTransitionBrowserTest() {}
22
23 SettingsOpenSectionTransitionBrowserTest.prototype = {
24 __proto__: PolymerTest.prototype,
25
26 /** @override */
27 browsePreload:
28 'chrome://md-settings/settings_page/open_section_transition.html',
29
30 /** @override */
31 extraLibraries: PolymerTest.getLibraries(ROOT_PATH),
32
33 /** @override */
34 isAsync: true,
35
36 /** @override */
37 runAccessibilityChecks: false,
38 };
39
40 TEST_F('SettingsOpenSectionTransitionBrowserTest', 'OpenSectionTransition',
41 function() {
42 suite('settings.animation.OpenSectionTransition', function() {
43 var container;
44 var section;
45 var card;
46
47 suiteSetup(function() {
48 return PolymerTest.importHtml('/settings_page/settings_section.html');
49 });
50
51 setup(function() {
52 container = document.createElement('div');
53 container.style.height = '1000px';
54 container.style.height = '800px';
55 section = document.createElement('settings-section');
56 section.style.height = '300px';
57 card = section.$.card;
58 container.appendChild(section);
59 document.body.appendChild(container);
60
61 // Simulate content and setup.
62 card.style.top = '10px';
63 card.style.height = '200px';
64 card.origHeight_ = card.clientHeight;
65 });
66
67 teardown(function() {
68 container.remove();
69 });
70
71 test('transition finishes', function() {
72 settings.animation.Timing.DURATION = 200;
73 var openTransition =
74 new settings.OpenSectionTransition(section, container);
75 var startTime = performance.now();
76 var finished = openTransition.play();
77 expectEquals('fixed', getComputedStyle(card).position);
78 return finished.then(function() {
79 // Ensure the animation actually played over a length of time.
80 // TODO(michaelpg): Verify this is not flaky.
81 var totalTime = performance.now() - startTime;
82 expectLE(settings.animation.Timing.DURATION, totalTime);
Dan Beam 2016/07/12 02:01:55 nit: I would reverse this, i.e. expectGE(totalTim
michaelpg 2016/07/20 22:10:57 agreed, Done
83 expectEquals('', card.style.position);
84
85 var closeTransition =
86 new settings.CloseSectionTransition(section, container);
87 closeTransition.setUp();
88 startTime = performance.now();
89 finished = closeTransition.play();
90 return finished.then(function() {
91 totalTime = performance.now() - startTime;
92 expectLE(settings.animation.Timing.DURATION, totalTime);
93 expectEquals('static', getComputedStyle(card).position);
94 });
95 });
96 });
97 // TODO(michaelpg): More tests.
98 });
99
100 // Run all registered tests.
101 mocha.run();
102 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698