{"version":3,"file":"ui-vts-kit-ng-vts-core-testing.mjs","sources":["../../components/core/testing/event-objects.ts","../../components/core/testing/dispatch-events.ts","../../components/core/testing/type-in-element.ts","../../components/core/testing/wrapped-error-message.ts","../../components/core/testing/fake-viewport-ruler.ts","../../components/core/testing/mock-ng-zone.ts","../../components/core/testing/component-bed.ts","../../components/core/testing/public-api.ts","../../components/core/testing/ui-vts-kit-ng-vts-core-testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { VtsSafeAny } from '@ui-vts-kit/ng-vts/core/types';\n\n/** Creates a browser MouseEvent with the specified options. */\nexport function createMouseEvent(\n  type: string,\n  x: number = 0,\n  y: number = 0,\n  button: number = 0\n): MouseEvent {\n  const event = document.createEvent('MouseEvent');\n\n  event.initMouseEvent(\n    type,\n    true /* canBubble */,\n    false /* cancelable */,\n    window /* view */,\n    0 /* detail */,\n    x /* screenX */,\n    y /* screenY */,\n    x /* clientX */,\n    y /* clientY */,\n    false /* ctrlKey */,\n    false /* altKey */,\n    false /* shiftKey */,\n    false /* metaKey */,\n    button /* button */,\n    null /* relatedTarget */\n  );\n\n  // `initMouseEvent` doesn't allow us to pass the `buttons` and\n  // defaults it to 0 which looks like a fake event.\n  Object.defineProperty(event, 'buttons', { get: () => 1 });\n\n  return event;\n}\n\n/** Creates a browser TouchEvent with the specified pointer coordinates. */\nexport function createTouchEvent(type: string, pageX: number = 0, pageY: number = 0): UIEvent {\n  // In favor of creating events that work for most of the browsers, the event is created\n  // as a basic UI Event. The necessary details for the event will be set manually.\n  const event = new UIEvent(type, { detail: 0, view: window });\n  const touchDetails = { pageX, pageY, clientX: pageX, clientY: pageY };\n\n  // Most of the browsers don't have a \"initTouchEvent\" method that can be used to define\n  // the touch details.\n  Object.defineProperties(event, {\n    touches: { value: [touchDetails] },\n    targetTouches: { value: [touchDetails] },\n    changedTouches: { value: [touchDetails] }\n  });\n\n  return event;\n}\n\n/** Dispatches a keydown event from an element. */\nexport function createKeyboardEvent(\n  type: string,\n  keyCode: number,\n  target?: Element,\n  key?: string,\n  ctrlKey?: boolean,\n  metaKey?: boolean,\n  shiftKey?: boolean\n): KeyboardEvent {\n  const event = document.createEvent('KeyboardEvent') as VtsSafeAny;\n  const originalPreventDefault = event.preventDefault;\n\n  // Firefox does not support `initKeyboardEvent`, but supports `initKeyEvent`.\n  if (event.initKeyEvent) {\n    event.initKeyEvent(type, true, true, window, 0, 0, 0, 0, 0, keyCode);\n  } else {\n    event.initKeyboardEvent(type, true, true, window, 0, key, 0, '', false);\n  }\n\n  // Webkit Browsers don't set the keyCode when calling the init function.\n  // See related bug https://bugs.webkit.org/show_bug.cgi?id=16735\n  Object.defineProperties(event, {\n    keyCode: { get: () => keyCode },\n    key: { get: () => key },\n    target: { get: () => target },\n    ctrlKey: { get: () => ctrlKey },\n    metaKey: { get: () => metaKey },\n    shiftKey: { get: () => shiftKey }\n  });\n\n  // IE won't set `defaultPrevented` on synthetic events so we need to do it manually.\n  // tslint:disable-next-line:typedef\n  event.preventDefault = function () {\n    Object.defineProperty(event, 'defaultPrevented', {\n      get: () => true,\n      configurable: true\n    });\n    // tslint:disable-next-line:no-invalid-this\n    return originalPreventDefault.apply(this, arguments);\n  };\n\n  return event;\n}\n\n/** Creates a fake event object with any desired event type. */\nexport function createFakeEvent(\n  type: string,\n  canBubble: boolean = true,\n  cancelable: boolean = true\n): Event {\n  const event = document.createEvent('Event');\n  event.initEvent(type, canBubble, cancelable);\n  return event;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n  createFakeEvent,\n  createKeyboardEvent,\n  createMouseEvent,\n  createTouchEvent\n} from './event-objects';\n\n/** Utility to dispatch any event on a Node. */\nexport function dispatchEvent(node: Node | Window, event: Event): Event {\n  node.dispatchEvent(event);\n  return event;\n}\n\n/** Shorthand to dispatch a fake event on a specified node. */\nexport function dispatchFakeEvent(node: Node | Window, type: string, canBubble?: boolean): Event {\n  return dispatchEvent(node, createFakeEvent(type, canBubble));\n}\n\n/** Shorthand to dispatch a keyboard event with a specified key code. */\nexport function dispatchKeyboardEvent(\n  node: Node,\n  type: string,\n  keyCode: number,\n  target?: Element\n): KeyboardEvent {\n  return dispatchEvent(node, createKeyboardEvent(type, keyCode, target)) as KeyboardEvent;\n}\n\n/** Shorthand to dispatch a mouse event on the specified coordinates. */\nexport function dispatchMouseEvent(\n  node: Node,\n  type: string,\n  x: number = 0,\n  y: number = 0,\n  event: MouseEvent = createMouseEvent(type, x, y)\n): MouseEvent {\n  return dispatchEvent(node, event) as MouseEvent;\n}\n\n/** Shorthand to dispatch a touch event on the specified coordinates. */\nexport function dispatchTouchEvent(\n  node: Node,\n  type: string,\n  x: number = 0,\n  y: number = 0\n): TouchEvent {\n  return dispatchEvent(node, createTouchEvent(type, x, y)) as TouchEvent;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { dispatchFakeEvent } from './dispatch-events';\n\n/**\n * Focuses an input, sets its value and dispatches\n * the `input` event, simulating the user typing.\n * @param value Value to be set on the input.\n * @param element Element onto which to set the value.\n */\nexport function typeInElement(\n  value: string,\n  element: HTMLInputElement | HTMLTextAreaElement\n): void {\n  element.focus();\n  element.value = value;\n  dispatchFakeEvent(element, 'input');\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * Gets a RegExp used to detect an angular wrapped error message.\n * See https://github.com/angular/angular/issues/8348\n */\nexport function wrappedErrorMessage(e: Error): RegExp {\n  const escapedMessage = e.message.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&');\n  return new RegExp(escapedMessage);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\ninterface FakeViewportRect {\n  left: number;\n  top: number;\n  width: number;\n  height: number;\n  bottom: number;\n  right: number;\n}\n\ninterface FakeViewportSize {\n  width: number;\n  height: number;\n}\n\ninterface FakeViewportScrollPosition {\n  top: number;\n  left: number;\n}\n\n/** @docs-private */\nexport class FakeViewportRuler {\n  getViewportRect(): FakeViewportRect {\n    return {\n      left: 0,\n      top: 0,\n      width: 1014,\n      height: 686,\n      bottom: 686,\n      right: 1014\n    };\n  }\n\n  getViewportSize(): FakeViewportSize {\n    return { width: 1014, height: 686 };\n  }\n\n  getViewportScrollPosition(): FakeViewportScrollPosition {\n    return { top: 0, left: 0 };\n  }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { EventEmitter, Injectable, NgZone } from '@angular/core';\n\n/**\n * Mock synchronous NgZone implementation that can be used\n * to flush out `onStable` subscriptions in tests.\n *\n * via: https://github.com/angular/angular/blob/master/packages/core/testing/src/ng_zone_mock.ts\n * @docs-private\n */\n@Injectable()\nexport class MockNgZone extends NgZone {\n  // tslint:disable-next-line:no-any\n  override onStable: EventEmitter<any> = new EventEmitter(false);\n\n  constructor() {\n    super({ enableLongStackTrace: false });\n  }\n\n  // tslint:disable-next-line:no-any ban-types\n  override run(fn: Function): any {\n    return fn();\n  }\n\n  // tslint:disable-next-line:ban-types no-any\n  override runOutsideAngular(fn: Function): any {\n    return fn();\n  }\n\n  simulateZoneExit(): void {\n    this.onStable.emit(null);\n  }\n}\n","import { CommonModule } from '@angular/common';\nimport { DebugElement, NgModule, NO_ERRORS_SCHEMA, Type } from '@angular/core';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\n\ntype ComponentBedOptions = Pick<NgModule, 'providers' | 'declarations' | 'imports'>;\nexport interface ComponentBed<T> {\n  bed: TestBed;\n  fixture: ComponentFixture<T>;\n  nativeElement: HTMLElement;\n  debugElement: DebugElement;\n  component: T;\n}\nexport function createComponentBed<T>(\n  component: Type<T>,\n  options: ComponentBedOptions = {\n    providers: [],\n    declarations: [],\n    imports: []\n  }\n): ComponentBed<T> {\n  const { imports, declarations, providers } = options;\n  const config = {\n    imports: [NoopAnimationsModule, CommonModule, ...(imports || [])],\n    declarations: [component, ...(declarations || [])],\n    schemas: [NO_ERRORS_SCHEMA],\n    providers: providers || []\n  };\n  const bed = TestBed.configureTestingModule(config);\n  const fixture = TestBed.createComponent<T>(component);\n  fixture.detectChanges();\n  return {\n    bed,\n    fixture,\n    nativeElement: fixture.nativeElement,\n    debugElement: fixture.debugElement,\n    component: fixture.componentInstance\n  };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './dispatch-events';\nexport * from './event-objects';\nexport * from './type-in-element';\nexport * from './wrapped-error-message';\nexport * from './fake-viewport-ruler';\nexport * from './mock-ng-zone';\nexport {\n  createComponentBed as ɵcreateComponentBed,\n  ComponentBed as ɵComponentBed\n} from './component-bed';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;AAIH;AACgB,SAAA,gBAAgB,CAC9B,IAAY,EACZ,CAAA,GAAY,CAAC,EACb,CAAY,GAAA,CAAC,EACb,MAAA,GAAiB,CAAC,EAAA;IAElB,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAEjD,IAAA,KAAK,CAAC,cAAc,CAClB,IAAI,EACJ,IAAI,kBACJ,KAAK,mBACL,MAAM,aACN,CAAC,eACD,CAAC,gBACD,CAAC,gBACD,CAAC,gBACD,CAAC,gBACD,KA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