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

Unified Diff: chrome/test/data/webui/settings/settings_animated_pages_test.js

Issue 2805363002: MD Settings: Add mechanism to restore focus after subpage exiting. (Closed)
Patch Set: Use tag name Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/settings_animated_pages_test.js
diff --git a/chrome/test/data/webui/settings/settings_animated_pages_test.js b/chrome/test/data/webui/settings/settings_animated_pages_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..acffcadccc46af8bf7eaf7baddce0d2b9cb64e53
--- /dev/null
+++ b/chrome/test/data/webui/settings/settings_animated_pages_test.js
@@ -0,0 +1,31 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+suite('settings-animated-pages', function() {
+ test('focuses subpage trigger when exiting subpage', function(done) {
+ document.body.innerHTML = `
+ <settings-animated-pages section="test-section">
+ <neon-animatable route-path="default">
+ <button id="subpage-trigger"></button>
+ </neon-animatable>
+ <neon-animatable route-path=${settings.Route.SEARCH_ENGINES.path}>
tommycli 2017/04/10 22:14:36 that's interesting... does this need double quotes
dpapad 2017/04/10 23:52:28 Added double quotes. They are not needed, but adde
+ <button id="subpage-trigger"></button>
+ </neon-animatable>
+ </settings-animated-pages>`;
+
+ var animatedPages = document.body.querySelector('settings-animated-pages');
+ animatedPages.focusConfig = new Map();
+ animatedPages.focusConfig.set(
+ settings.Route.SEARCH_ENGINES.path, '#subpage-trigger');
+
+ animatedPages.$.animatedPages.selected = settings.Route.SEARCH_ENGINES.path;
+
+ var trigger = document.body.querySelector('#subpage-trigger');
tommycli 2017/04/10 22:14:36 i'm assuming you put it in its own variable so you
dpapad 2017/04/10 23:52:28 Done.
+ trigger.addEventListener('focus', function() { done(); });
+
+ // Trigger subpage exit.
+ animatedPages.currentRouteChanged(
+ settings.Route.BASIC, settings.Route.SEARCH_ENGINES);
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698