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

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: Address @dbeam comments. 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
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_interactive_ui_tests.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fd47f641a397826fb65caef2a02606d79e124a3a
--- /dev/null
+++ b/chrome/test/data/webui/settings/settings_animated_pages_test.js
@@ -0,0 +1,32 @@
+// 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}">
+ <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');
+ assertTrue(!!trigger);
+ trigger.addEventListener('focus', function() { done(); });
+
+ // Trigger subpage exit.
+ animatedPages.currentRouteChanged(
+ settings.Route.BASIC, settings.Route.SEARCH_ENGINES);
+ });
+});
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_interactive_ui_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698