File tree 2 files changed +8
-9
lines changed
2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
import { createWindowApi } from "./window.function" ;
2
- import { NativeAdapter } from "./adapter/native.adapter.class" ;
3
2
import { Window } from "./window.class" ;
4
3
import providerRegistry from "./provider/provider-registry.class" ;
5
4
@@ -9,7 +8,7 @@ describe("WindowApi", () => {
9
8
describe ( "getWindows" , ( ) => {
10
9
it ( "should return a list of open Windows" , async ( ) => {
11
10
// GIVEN
12
- const SUT = createWindowApi ( new NativeAdapter ( providerRegistry ) ) ;
11
+ const SUT = createWindowApi ( providerRegistry ) ;
13
12
14
13
// WHEN
15
14
const windows = await SUT . getWindows ( )
@@ -24,7 +23,7 @@ describe("WindowApi", () => {
24
23
describe ( "getActiveWindow" , ( ) => {
25
24
it ( "should return the a single Window which is currently active" , async ( ) => {
26
25
// GIVEN
27
- const SUT = createWindowApi ( new NativeAdapter ( providerRegistry ) ) ;
26
+ const SUT = createWindowApi ( providerRegistry ) ;
28
27
29
28
// WHEN
30
29
const window = await SUT . getActiveWindow ( ) ;
Original file line number Diff line number Diff line change 1
1
import { WindowApi } from "./window-api.interface" ;
2
- import { NativeAdapter } from "./adapter/native.adapter.class" ;
3
2
import { Window } from "./window.class" ;
3
+ import { ProviderRegistry } from "./provider/provider-registry.class" ;
4
4
5
- export const createWindowApi = ( nativeAdapter : NativeAdapter ) : WindowApi => {
5
+ export const createWindowApi = ( providerRegistry : ProviderRegistry ) : WindowApi => {
6
6
return ( {
7
7
async getActiveWindow ( ) : Promise < Window > {
8
- const windowHandle = await nativeAdapter . getActiveWindow ( ) ;
9
- return new Window ( nativeAdapter , windowHandle ) ;
8
+ const windowHandle = await providerRegistry . getWindow ( ) . getActiveWindow ( ) ;
9
+ return new Window ( providerRegistry , windowHandle ) ;
10
10
} ,
11
11
async getWindows ( ) : Promise < Window [ ] > {
12
- const windowHandles = await nativeAdapter . getWindows ( ) ;
12
+ const windowHandles = await providerRegistry . getWindow ( ) . getWindows ( ) ;
13
13
return windowHandles . map ( ( handle : number ) => {
14
- return new Window ( nativeAdapter , handle ) ;
14
+ return new Window ( providerRegistry , handle ) ;
15
15
} ) ;
16
16
} ,
17
17
} ) ;
You can’t perform that action at this time.
0 commit comments