Options
All
  • Public
  • Public/Protected
  • All
Menu

Mock of WindowService for unit tests

export
class

MockWindowService

extends

{WindowService}

Hierarchy

Index

Constructors

constructor

Properties

app

app: App

title

title: string

Accessors

location

Methods

alert

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

assert

  • assert(): void

back

  • back(): void

confirm

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

expectAlert

  • 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

expectNotification

  • 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
  • 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

    Parameters

    • popupType: string
    • windowAction: function
        • (vm: TViewModel): any
        • Parameters

          • vm: TViewModel

          Returns any

    Returns IDisposable

expectWindow

  • expectWindow<TViewModel>(windowType: string, windowAction: function): IDisposable
  • 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

    Parameters

    • windowType: string
    • windowAction: function
        • (vm: TViewModel): any
        • Parameters

          • vm: TViewModel

          Returns any

    Returns IDisposable

Protected forceRemove

  • forceRemove(view: any): void

navigate

  • navigate(url: string): void

notify

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

openPage

openTestWindow

Protected openWindow

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

refresh

  • refresh(): void

Protected registerForPopup

  • registerForPopup(): void

registerNavigationHook

remove

  • remove(view: object, force?: boolean): Promise<boolean>
  • 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

Generated using TypeDoc