Mock of WindowService for unit tests

export
class

  MockWindowService

extends

  {WindowService}

### Hierarchy

- NavigationService
  - MockNavigationService

## Index

### Constructors

- constructor

### Properties

- app
- title

### Accessors

- location

### Methods

- alert
- assert
- back
- confirm
- expectAlert
- expectConfirm
- expectNotification
- expectPopup
- expectWindow
- forceRemove
- navigate
- notify
- openPage
- openTestWindow
- openWindow
- refresh
- registerForPopup
- registerNavigationHook
- remove
- removeRegistration

## Constructors

### constructor

- new MockNavigationService(app: App): MockNavigationService

- Overrides NavigationService.constructor

  - Defined in src/services/MockNavigationService.ts:58

  #### Parameters

  - ##### app: App

  #### Returns MockNavigationService

## Properties

### app

app: App

Inherited from NavigationService.app

- Defined in src/services/NavigationService.ts:70

### title

title: string

Overrides NavigationService.title

- Defined in src/services/MockNavigationService.ts:33

## Accessors

### location

- get location(): AtomUri
- set location(v: AtomUri): void

- Overrides NavigationService.location

  - Defined in src/services/MockNavigationService.ts:48

  Gets current location of browser, this does not return actual location but it returns values of browser location. This is done to provide mocking behavior for unit testing.

  readonly
  type

    {AtomLocation}

  memberof

    BrowserService

  #### Returns AtomUri

- Overrides NavigationService.location

  - Defined in src/services/MockNavigationService.ts:52

  Gets current location of browser, this does not return actual location but it returns values of browser location. This is done to provide mocking behavior for unit testing.

  #### Parameters

  - ##### v: AtomUri

  #### Returns void

## Methods

### alert

- alert(msg: string, title?: string): Promise<any>

- Overrides NavigationService.alert

  - Defined in src/services/MockNavigationService.ts:92

  Internal usage

  memberof

    MockWindowService

  #### Parameters

  - ##### msg: string

  - ##### Optional title: string

  #### Returns Promise<any>

### assert

- assert(): void

- - Defined in src/services/MockNavigationService.ts:255

  #### Returns void

### back

- back(): void

- Overrides NavigationService.back

  - Defined in src/services/MockNavigationService.ts:77

  #### Returns void

### confirm

- confirm(msg: string, title?: string): Promise<boolean>

- Overrides NavigationService.confirm

  - Defined in src/services/MockNavigationService.ts:103

  Internal usage

  memberof

    MockWindowService

  #### Parameters

  - ##### msg: string

  - ##### Optional title: string

  #### Returns Promise<boolean>

### expectAlert

- expectAlert(msg: string): IDisposable

- - Defined in src/services/MockNavigationService.ts:174

  Call this method before any method that should expect an alert. You can add many alerts, but each expected alert will only be called once.

  memberof

    MockWindowService

  #### Parameters

  - ##### msg: string

  #### Returns IDisposable

### expectConfirm

- expectConfirm(msg: string, action: function): IDisposable

- - Defined in src/services/MockNavigationService.ts:199

  Call this method before any method that should expect a confirm. You can add many confirms, but each expected confirm will only be called once.

  memberof

    MockWindowService

  #### Parameters

  - ##### msg: string

  - ##### action: function

    - - (vm: MockConfirmViewModel): boolean

      - #### Parameters

        - ##### vm: MockConfirmViewModel

        #### Returns boolean

  #### Returns IDisposable

### expectNotification

- expectNotification(msg: string): IDisposable

- - Defined in src/services/MockNavigationService.ts:186

  Call this method before any method that should expect a notification. You can add many alerts, but each expected alert will only be called once.

  memberof

    MockWindowService

  #### Parameters

  - ##### msg: string

  #### Returns IDisposable

### expectPopup

- expectPopup<TViewModel>(popupType: string, windowAction: function): IDisposable

- - Defined in src/services/MockNavigationService.ts:214

  Call this method before any method that should expect a window of given type. Each window will only be used once and return value in windowAction will be resolved in promise created by openWindow call.

  template

    TViewModel

  memberof

    MockWindowService

  #### Type parameters

  - #### TViewModel: AtomViewModel

  #### Parameters

  - ##### popupType: string

  - ##### windowAction: function

    - - (vm: TViewModel): any

      - #### Parameters

        - ##### vm: TViewModel

        #### Returns any

  #### Returns IDisposable

### expectWindow

- expectWindow<TViewModel>(windowType: string, windowAction: function): IDisposable

- - Defined in src/services/MockNavigationService.ts:231

  Call this method before any method that should expect a window of given type. Each window will only be used once and return value in windowAction will be resolved in promise created by openWindow call.

  template

    TViewModel

  memberof

    MockWindowService

  #### Type parameters

  - #### TViewModel: AtomViewModel

  #### Parameters

  - ##### windowType: string

  - ##### windowAction: function

    - - (vm: TViewModel): any

      - #### Parameters

        - ##### vm: TViewModel

        #### Returns any

  #### Returns IDisposable

### Protected forceRemove

- forceRemove(view: any): void

- - Defined in src/services/MockNavigationService.ts:267

  #### Parameters

  - ##### view: any

  #### Returns void

### navigate

- navigate(url: string): void

- Overrides NavigationService.navigate

  - Defined in src/services/MockNavigationService.ts:73

  Navigate current browser to given url.

  memberof

    BrowserService

  #### Parameters

  - ##### url: string

  #### Returns void

### notify

- notify(message: string, title?: string): void

- Overrides NavigationService.notify

  - Defined in src/services/MockNavigationService.ts:111

  #### Parameters

  - ##### message: string

  - ##### Optional title: string

  #### Returns void

### openPage

- openPage<T>(pageName: string, p?: INameValuePairs): Promise<T>

- Overrides NavigationService.openPage

  - Defined in src/services/MockNavigationService.ts:107

  #### Type parameters

  - #### T

  #### Parameters

  - ##### pageName: string

  - ##### Optional p: INameValuePairs

  #### Returns Promise<T>

### openTestWindow

- openTestWindow<T>(c: string | AtomUri, p?: INameValues): Promise<T>

- - Defined in src/services/MockNavigationService.ts:128

  Internal usage

  template

    T

  memberof

    MockWindowService

  #### Type parameters

  - #### T

  #### Parameters

  - ##### c: string | AtomUri

  - ##### Optional p: INameValues

  #### Returns Promise<T>

### Protected openWindow

- openWindow<T>(url: AtomUri): Promise<T>

- Overrides NavigationService.openWindow

  - Defined in src/services/MockNavigationService.ts:271

  #### Type parameters

  - #### T

  #### Parameters

  - ##### url: AtomUri

  #### Returns Promise<T>

### refresh

- refresh(): void

- Overrides NavigationService.refresh

  - Defined in src/services/MockNavigationService.ts:64

  #### Returns void

### Protected registerForPopup

- registerForPopup(): void

- - Defined in src/services/MockNavigationService.ts:263

  #### Returns void

### registerNavigationHook

- registerNavigationHook(callback: navigateCallback): IDisposable

- Inherited from NavigationService.registerNavigationHook

  - Defined in src/services/NavigationService.ts:174

  #### Parameters

  - ##### callback: navigateCallback

  #### Returns IDisposable

### remove

- remove(view: object, force?: boolean): Promise<boolean>

- Inherited from NavigationService.remove

  - Defined in src/services/NavigationService.ts:160

  Sends signal to remove window/popup/frame, it will not immediately remove, because it will identify whether it can remove or not by displaying cancellation warning. Only if there is no cancellation warning or user chooses to force close, it will not remove.

  #### Parameters

  - ##### view: object

  - ##### Optional force: boolean

  #### Returns Promise<boolean>

  true if view was removed successfully

### removeRegistration

- removeRegistration(r: IWindowRegistration): void

- - Defined in src/services/MockNavigationService.ts:251

  #### Parameters

  - ##### r: IWindowRegistration

  #### Returns void

Generated using TypeDoc