mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-08 04:44:04 +08:00
With crrev.com/c/2960171 the sources panel was set to be opened when a breakpoint was hit only if an experiment was enabled. However this behaviour was extended to other triggers of the sources panel, like when a file is selected using the quick open menu. This means that using the quick open menu to open a file in the sources panel would only work if the experiment discussed before is enabled. To fix this, the check for the experiment value was moved to the call sites triggered specifically after a Debugger.paused event Bug: none Change-Id: I9eb53091b04e63627813e14a8ed6bc6605e92b3b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3271700 Reviewed-by: Kim-Anh Tran <kimanh@chromium.org> Commit-Queue: Andres Olivares <andoli@chromium.org>
46 lines
1.9 KiB
TypeScript
46 lines
1.9 KiB
TypeScript
// Copyright 2021 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 {click, getBrowserAndPages, goToResource, step, waitFor} from '../../shared/helper.js';
|
|
import {describe, it} from '../../shared/mocha-extensions.js';
|
|
import {navigateToElementsTab} from '../helpers/elements-helpers.js';
|
|
import {getMenuItemAtPosition, getMenuItemTitleAtPosition, openFileQuickOpen} from '../helpers/quick_open-helpers.js';
|
|
import {togglePreferenceInSettingsTab} from '../helpers/settings-helpers.js';
|
|
import {listenForSourceFilesLoaded, waitForSourceLoadedEvent} from '../helpers/sources-helpers.js';
|
|
|
|
async function openAFileWithQuickMenu() {
|
|
const {frontend} = getBrowserAndPages();
|
|
await listenForSourceFilesLoaded(frontend);
|
|
await step('navigate to elements tab', async () => {
|
|
await navigateToElementsTab();
|
|
});
|
|
await step('open quick open menu and select the first option', async () => {
|
|
await goToResource('pages/hello-world.html');
|
|
await openFileQuickOpen();
|
|
const firstItem = await getMenuItemAtPosition(0);
|
|
await click(firstItem);
|
|
});
|
|
await step('check the sources panel is open with the selected file', async () => {
|
|
await waitFor('.navigator-file-tree-item');
|
|
await waitForSourceLoadedEvent(frontend, 'hello-world.html');
|
|
});
|
|
}
|
|
|
|
describe('Quick Open menu', () => {
|
|
it('lists available files', async () => {
|
|
await goToResource('pages/hello-world.html');
|
|
await openFileQuickOpen();
|
|
const firstItemTitle = await getMenuItemTitleAtPosition(0);
|
|
assert.strictEqual(firstItemTitle, 'hello-world.html');
|
|
});
|
|
|
|
it('opens the sources panel when a file is selected', async () => {
|
|
await openAFileWithQuickMenu();
|
|
await togglePreferenceInSettingsTab('Focus Sources panel when triggering a breakpoint');
|
|
await openAFileWithQuickMenu();
|
|
});
|
|
});
|