-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(workbench/host): retain focus on element that closed popup due to…
… loss of focus Previously, when a microfrontend popup was closed due to loss of focus, that is, when an element outside the popup was clicked, the focus did not remain on that element that caused the popup to lose focus.
- Loading branch information
1 parent
9293464
commit 29c82bf
Showing
21 changed files
with
359 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...testing-app/src/app/test-pages/input-field-test-page/input-field-test-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<sci-form-field label="Input Field"> | ||
<input class="e2e-input"> | ||
</sci-form-field> |
4 changes: 4 additions & 0 deletions
4
...testing-app/src/app/test-pages/input-field-test-page/input-field-test-page.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:host { | ||
display: block; | ||
padding: 1em; | ||
} |
24 changes: 24 additions & 0 deletions
24
...t-testing-app/src/app/test-pages/input-field-test-page/input-field-test-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) 2018-2022 Swiss Federal Railways | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
import {Component} from '@angular/core'; | ||
import {SciFormFieldModule} from '@scion/components.internal/form-field'; | ||
|
||
@Component({ | ||
selector: 'app-input-field-test-page', | ||
templateUrl: './input-field-test-page.component.html', | ||
styleUrls: ['./input-field-test-page.component.scss'], | ||
standalone: true, | ||
imports: [ | ||
SciFormFieldModule, | ||
], | ||
}) | ||
export class InputFieldTestPageComponent { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...testing-app/src/app/test-pages/input-field-test-page/input-field-test-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<sci-form-field label="Input Field"> | ||
<input class="e2e-input"> | ||
</sci-form-field> |
4 changes: 4 additions & 0 deletions
4
...testing-app/src/app/test-pages/input-field-test-page/input-field-test-page.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:host { | ||
display: block; | ||
padding: 1em; | ||
} |
24 changes: 24 additions & 0 deletions
24
...h-testing-app/src/app/test-pages/input-field-test-page/input-field-test-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) 2018-2022 Swiss Federal Railways | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
import {Component} from '@angular/core'; | ||
import {SciFormFieldModule} from '@scion/components.internal/form-field'; | ||
|
||
@Component({ | ||
selector: 'app-input-field-test-page', | ||
templateUrl: './input-field-test-page.component.html', | ||
styleUrls: ['./input-field-test-page.component.scss'], | ||
standalone: true, | ||
imports: [ | ||
SciFormFieldModule, | ||
], | ||
}) | ||
export class InputFieldTestPageComponent { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2018-2022 Swiss Federal Railways | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
import {Routes} from '@angular/router'; | ||
import {WorkbenchRouteData} from '@scion/workbench'; | ||
|
||
export const routes: Routes = [ | ||
{ | ||
path: 'bulk-navigation-test-page', | ||
loadComponent: (): any => import('./bulk-navigation-test-page/bulk-navigation-test-page.component').then(m => m.BulkNavigationTestPageComponent), | ||
data: {[WorkbenchRouteData.title]: 'Bulk Navigation Test', [WorkbenchRouteData.heading]: 'Workbench E2E Testpage', [WorkbenchRouteData.cssClass]: 'e2e-test-bulk-navigation'}, | ||
}, | ||
{ | ||
path: 'view-route-data-test-page', | ||
loadChildren: (): any => import('./view-route-data-test-page/view-route-data-test-page.module').then(m => m.ViewRouteDataTestPageModule), | ||
data: {[WorkbenchRouteData.title]: 'View Route Data Test', [WorkbenchRouteData.heading]: 'Workbench E2E Testpage', [WorkbenchRouteData.cssClass]: 'e2e-test-view-route-data'}, | ||
}, | ||
{ | ||
path: 'input-field-test-page', | ||
loadComponent: (): any => import('./input-field-test-page/input-field-test-page.component').then(m => m.InputFieldTestPageComponent), | ||
data: {[WorkbenchRouteData.title]: 'Input Field Test Page', [WorkbenchRouteData.heading]: 'Workbench E2E Testpage', [WorkbenchRouteData.cssClass]: 'e2e-test-input-field'}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...scion/e2e-testing/src/workbench-client/page-object/test-pages/input-field-test-page.po.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2018-2022 Swiss Federal Railways | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
import {AppPO} from '../../../app.po'; | ||
import {Locator} from '@playwright/test'; | ||
import {isActiveElement} from '../../../helper/testing.util'; | ||
import {ElementSelectors} from '../../../helper/element-selectors'; | ||
import {MicrofrontendNavigator} from '../../microfrontend-navigator'; | ||
import {RegisterWorkbenchCapabilityPagePO} from '../register-workbench-capability-page.po'; | ||
import {ViewPO} from '../../../view.po'; | ||
|
||
export class InputFieldTestPagePO { | ||
|
||
private readonly _locator: Locator; | ||
public readonly view: ViewPO; | ||
|
||
constructor(appPO: AppPO, viewId: string) { | ||
this.view = appPO.view({viewId}); | ||
this._locator = appPO.page.frameLocator(ElementSelectors.routerOutletFrame(viewId)).locator('app-input-field-test-page'); | ||
} | ||
|
||
public async clickInputField(): Promise<void> { | ||
await this._locator.locator('input.e2e-input').click(); | ||
} | ||
|
||
public async isActiveElement(): Promise<boolean> { | ||
return isActiveElement(this._locator.locator('input.e2e-input')); | ||
} | ||
|
||
public static async openInNewTab(appPO: AppPO, microfrontendNavigator: MicrofrontendNavigator): Promise<InputFieldTestPagePO> { | ||
// Register the test page as view. | ||
const registerCapabilityPagePO = await microfrontendNavigator.openInNewTab(RegisterWorkbenchCapabilityPagePO, 'app1'); | ||
await registerCapabilityPagePO.registerCapability({ | ||
type: 'view', | ||
qualifier: {test: 'input-field'}, | ||
properties: { | ||
path: 'test-pages/input-field-test-page', | ||
cssClass: 'e2e-test-input-field', | ||
title: 'Input Field Test Page', | ||
pinToStartPage: true, | ||
}, | ||
}); | ||
await registerCapabilityPagePO.viewTabPO.close(); | ||
|
||
// Navigate to the view. | ||
const startPagePO = await appPO.openNewViewTab(); | ||
await startPagePO.clickTestCapability('e2e-test-input-field', 'app1'); | ||
|
||
// Create the page object. | ||
const view = await appPO.view({cssClass: 'e2e-test-input-field'}); | ||
await view.waitUntilPresent(); | ||
return new InputFieldTestPagePO(appPO, await view.getViewId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.