Revert "Add a global setting for search as you type"
This reverts commit b4643a4703b4a26945d1446eedc907ac81373e23.
Reason for revert: Newly introduced tests are flaky in mac builder[1]
[1]: https://ci.chromium.org/ui/p/devtools-frontend/builders/ci/Stand-alone%20Mac/8140/overview
Original change's description:
> Add a global setting for search as you type
>
> Added a global setting to the settings screen and to the command menu
> for enabling search-as-you-type, or requiring Enter for searching,
> in search boxes that support it.
>
> - Added strings, a setting and commands for the new setting.
> - Bailed early on input when the setting is disabled.
> - Tests -
> - Added general helpers for getting text contents and summoning the
> search box.
> - Added elements-panel-specific helpers for the tests.
> - Made the setting toggle helper accept an optional expected state.
>
> Bug: 1344526
> Change-Id: I75612a54c10d5f40b208084fdbd0ffd7614f7f7c
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3859617
> Auto-Submit: PhistucK Productions <phistuck@gmail.com>
> Commit-Queue: PhistucK Productions <phistuck@gmail.com>
> Reviewed-by: Victor Porof <victorporof@chromium.org>
> Reviewed-by: Ergün Erdoğmuş <ergunsh@chromium.org>
Bug: 1344526
Change-Id: I8f9adda6dbca6b4f553cbe6cdd3bffea9088efc2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3865263
Reviewed-by: Victor Porof <victorporof@chromium.org>
Commit-Queue: Victor Porof <victorporof@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Ergün Erdoğmuş <ergunsh@chromium.org>
diff --git a/front_end/core/i18n/locales/en-US.json b/front_end/core/i18n/locales/en-US.json
index ffa1553..c2b2748 100644
--- a/front_end/core/i18n/locales/en-US.json
+++ b/front_end/core/i18n/locales/en-US.json
@@ -896,15 +896,6 @@
"entrypoints/inspector_main/inspector_main-meta.ts | rendering": {
"message": "Rendering"
},
- "entrypoints/inspector_main/inspector_main-meta.ts | searchAsYouTypeCommand": {
- "message": "Enable search as you type"
- },
- "entrypoints/inspector_main/inspector_main-meta.ts | searchAsYouTypeSetting": {
- "message": "Search as you type"
- },
- "entrypoints/inspector_main/inspector_main-meta.ts | searchOnEnterCommand": {
- "message": "Disable search as you type (press Enter to search)"
- },
"entrypoints/inspector_main/inspector_main-meta.ts | showAds": {
"message": "Show ads on this site, if allowed"
},
diff --git a/front_end/core/i18n/locales/en-XL.json b/front_end/core/i18n/locales/en-XL.json
index 8a61c92..2f26939 100644
--- a/front_end/core/i18n/locales/en-XL.json
+++ b/front_end/core/i18n/locales/en-XL.json
@@ -896,15 +896,6 @@
"entrypoints/inspector_main/inspector_main-meta.ts | rendering": {
"message": "R̂én̂d́êŕîńĝ"
},
- "entrypoints/inspector_main/inspector_main-meta.ts | searchAsYouTypeCommand": {
- "message": "Êńâb́l̂é ŝéâŕĉh́ âś ŷóû t́ŷṕê"
- },
- "entrypoints/inspector_main/inspector_main-meta.ts | searchAsYouTypeSetting": {
- "message": "Ŝéâŕĉh́ âś ŷóû t́ŷṕê"
- },
- "entrypoints/inspector_main/inspector_main-meta.ts | searchOnEnterCommand": {
- "message": "D̂íŝáb̂ĺê śêár̂ćĥ áŝ ýôú t̂ýp̂é (p̂ŕêśŝ Én̂t́êŕ t̂ó ŝéâŕĉh́)"
- },
"entrypoints/inspector_main/inspector_main-meta.ts | showAds": {
"message": "Ŝh́ôẃ âd́ŝ ón̂ t́ĥíŝ śît́ê, íf̂ ál̂ĺôẃêd́"
},
diff --git a/front_end/entrypoints/inspector_main/inspector_main-meta.ts b/front_end/entrypoints/inspector_main/inspector_main-meta.ts
index f6025cf..1ae2a63 100644
--- a/front_end/entrypoints/inspector_main/inspector_main-meta.ts
+++ b/front_end/entrypoints/inspector_main/inspector_main-meta.ts
@@ -93,21 +93,6 @@
*/
doNotAutoOpen: 'Do not auto-open DevTools for popups',
/**
- * @description A command available in the command menu to perform searches, for example in the
- * elements panel, as user types, rather than only when they press Enter.
- */
- searchAsYouTypeSetting: 'Search as you type',
- /**
- * @description A command available in the command menu to perform searches, for example in the
- * elements panel, as user types, rather than only when they press Enter.
- */
- searchAsYouTypeCommand: 'Enable search as you type',
- /**
- * @description A command available in the command menu to perform searches, for example in the
- * elements panel, only when the user presses Enter.
- */
- searchOnEnterCommand: 'Disable search as you type (press Enter to search)',
- /**
* @description Title of a setting under the Appearance category in Settings. When the webpage is
* paused by devtools, an overlay is shown on top of the page to indicate that it is paused. The
* overlay is a pause/unpause button and some text, which appears on top of the paused page. This
@@ -261,26 +246,6 @@
});
Common.Settings.registerSettingExtension({
- category: Common.Settings.SettingCategory.GLOBAL,
- storageType: Common.Settings.SettingStorageType.Local,
- title: i18nLazyString(UIStrings.searchAsYouTypeSetting),
- settingName: 'searchAsYouType',
- settingType: Common.Settings.SettingType.BOOLEAN,
- order: 3,
- defaultValue: true,
- options: [
- {
- value: true,
- title: i18nLazyString(UIStrings.searchAsYouTypeCommand),
- },
- {
- value: false,
- title: i18nLazyString(UIStrings.searchOnEnterCommand),
- },
- ],
-});
-
-Common.Settings.registerSettingExtension({
category: Common.Settings.SettingCategory.APPEARANCE,
storageType: Common.Settings.SettingStorageType.Synced,
title: i18nLazyString(UIStrings.disablePaused),
diff --git a/front_end/ui/legacy/SearchableView.ts b/front_end/ui/legacy/SearchableView.ts
index 7fe95a7..9e8e5f0 100644
--- a/front_end/ui/legacy/SearchableView.ts
+++ b/front_end/ui/legacy/SearchableView.ts
@@ -561,10 +561,6 @@
}
private onInput(_event: Event): void {
- if (!Common.Settings.Settings.instance().moduleSetting('searchAsYouType').get()) {
- return;
- }
-
if (this.valueChangedTimeoutId) {
clearTimeout(this.valueChangedTimeoutId);
}
diff --git a/test/e2e/elements/BUILD.gn b/test/e2e/elements/BUILD.gn
index de7a3f2..782a6f2 100644
--- a/test/e2e/elements/BUILD.gn
+++ b/test/e2e/elements/BUILD.gn
@@ -19,7 +19,6 @@
"oopif-elements_test.ts",
"pseudo-states_test.ts",
"reveal-correct-node_test.ts",
- "search-elements_test.ts",
"selection-after-delete_test.ts",
"shadowroot-styles_test.ts",
"sidebar-event-listeners-remove_test.ts",
diff --git a/test/e2e/elements/search-elements_test.ts b/test/e2e/elements/search-elements_test.ts
deleted file mode 100644
index 11394eb..0000000
--- a/test/e2e/elements/search-elements_test.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2022 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.
-
-import {assert} from 'chai';
-
-import {getBrowserAndPages} from '../../shared/helper.js';
-import {describe, it} from '../../shared/mocha-extensions.js';
-import {getSearchResultMatchesText, summonAndWaitForSearchBox} from '../helpers/elements-helpers.js';
-import {togglePreferenceInSettingsTab} from '../helpers/settings-helpers.js';
-
-describe('The Elements tab', async () => {
- it('search is only performed when Enter is pressed when the "searchAsYouType" setting is disabled', async () => {
- await togglePreferenceInSettingsTab('Search as you type', false);
- await summonAndWaitForSearchBox();
- const {frontend} = getBrowserAndPages();
-
- await frontend.keyboard.type('html');
-
- // Wait a bit in case the search results are fetched, otherwise the assertion might always pass.
- await new Promise(r => setTimeout(r, 200));
-
- assert.strictEqual(await getSearchResultMatchesText(), '');
-
- frontend.keyboard.press('Enter');
-
- assert.notEqual(await getSearchResultMatchesText(), '');
- });
-
- it('search is performed as the user types when the "searchAsYouType" setting is enabled', async () => {
- await togglePreferenceInSettingsTab('Search as you type', true);
- await summonAndWaitForSearchBox();
- const {frontend} = getBrowserAndPages();
-
- await frontend.keyboard.type('html');
-
- assert.notEqual(await getSearchResultMatchesText(), '');
- });
-});
diff --git a/test/e2e/helpers/elements-helpers.ts b/test/e2e/helpers/elements-helpers.ts
index 0aa85ac..573c540 100644
--- a/test/e2e/helpers/elements-helpers.ts
+++ b/test/e2e/helpers/elements-helpers.ts
@@ -10,10 +10,8 @@
$$,
click,
getBrowserAndPages,
- getTextContent,
pressKey,
step,
- summonSearchBox,
timeout,
typeText,
waitFor,
@@ -48,8 +46,6 @@
const ELEMENT_STYLE_SECTION_SELECTOR = '[aria-label="element.style, css selector"]';
const STYLE_QUERY_RULE_TEXT_SELECTOR = '.query-text';
const CSS_AUTHORING_HINTS_ICON_SELECTOR = '.hint';
-const SEARCH_BOX_SELECTOR = '.search-bar';
-const SEARCH_RESULTS_MATCHES = '.search-results-matches';
export const openLayoutPane = async () => {
await step('Open Layout pane', async () => {
@@ -795,12 +791,3 @@
return propertiesWithHints;
};
-
-export const summonAndWaitForSearchBox = async () => {
- await summonSearchBox();
- await waitFor(SEARCH_BOX_SELECTOR);
-};
-
-export const getSearchResultMatchesText = async () => {
- return await getTextContent(SEARCH_RESULTS_MATCHES);
-};
diff --git a/test/e2e/helpers/settings-helpers.ts b/test/e2e/helpers/settings-helpers.ts
index e998c62..6b1bf88 100644
--- a/test/e2e/helpers/settings-helpers.ts
+++ b/test/e2e/helpers/settings-helpers.ts
@@ -43,23 +43,21 @@
await click('.dialog-close-button');
};
-export const togglePreferenceInSettingsTab = async (label: string, shouldBeChecked?: boolean) => {
+export const togglePreferenceInSettingsTab = async (label: string) => {
await openSettingsTab('Preferences');
- const selector = `[aria-label="${label}"]`;
+ const selector = `[aria-label="${label}"`;
await scrollElementIntoView(selector);
const preference = await waitFor(selector);
const value = await preference.evaluate(checkbox => (checkbox as HTMLInputElement).checked);
- if (value !== shouldBeChecked) {
- await click(preference);
+ await click(preference);
- await waitForFunction(async () => {
- const newValue = await preference.evaluate(checkbox => (checkbox as HTMLInputElement).checked);
- return newValue !== value;
- });
- }
+ await waitForFunction(async () => {
+ const newValue = await preference.evaluate(checkbox => (checkbox as HTMLInputElement).checked);
+ return newValue !== value;
+ });
await closeSettings();
};
diff --git a/test/shared/helper.ts b/test/shared/helper.ts
index c495fc2..4661433 100644
--- a/test/shared/helper.ts
+++ b/test/shared/helper.ts
@@ -225,11 +225,6 @@
export const timeout = (duration: number) => new Promise(resolve => setTimeout(resolve, duration));
-export const getTextContent = async<ElementType extends Element = Element>(selector: string) => {
- const text = await (await $<ElementType>(selector))?.evaluate(node => node.textContent);
- return text ?? undefined;
-};
-
export const waitFor = async<ElementType extends Element = Element>(
selector: string, root?: puppeteer.JSHandle, asyncScope = new AsyncScope(), handler?: string) => {
return await asyncScope.exec(() => waitForFunction(async () => {
@@ -726,10 +721,3 @@
}
assert.strictEqual(await checkbox.evaluate(box => (box as HTMLInputElement).checked), wantChecked);
}
-
-export const summonSearchBox = async () => {
- const {frontend} = getBrowserAndPages();
- await frontend.keyboard.down('Control');
- await frontend.keyboard.press('f');
- await frontend.keyboard.up('Control');
-};