{"version":3,"file":"ng-zorro-antd-core-testing.mjs","sources":["../../components/core/testing/directionality.ts","../../components/core/testing/event-objects.ts","../../components/core/testing/dispatch-events.ts","../../components/core/testing/mock-ng-zone.ts","../../components/core/testing/type-in-element.ts","../../components/core/testing/zoneless-helpers.ts","../../components/core/testing/public-api.ts","../../components/core/testing/ng-zorro-antd-core-testing.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { EnvironmentProviders, makeEnvironmentProviders, signal } from '@angular/core';\nimport { Subject } from 'rxjs';\n\nclass MockDirectionality {\n  value = 'ltr';\n  change = new Subject();\n  valueSignal = signal('ltr');\n}\n\nexport function provideMockDirectionality(): EnvironmentProviders {\n  return makeEnvironmentProviders([{ provide: Directionality, useClass: MockDirectionality }]);\n}\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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n/** Creates a browser MouseEvent with the specified options. */\nexport function createMouseEvent(type: string, x: number = 0, y: number = 0, button: number = 0): 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 NzSafeAny;\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  return event;\n}\n\n/** Creates a fake event object with any desired event type. */\nexport function createFakeEvent(type: string, canBubble: boolean = true, cancelable: boolean = true): Event {\n  const event = document.createEvent('Event');\n  event.initEvent(type, canBubble, cancelable);\n  return event;\n}\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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { createFakeEvent, createKeyboardEvent, createMouseEvent, createTouchEvent } 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(node: Node, type: string, keyCode: number, target?: Element): 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(node: Node, type: string, x: number = 0, y: number = 0): TouchEvent {\n  return dispatchEvent(node, createTouchEvent(type, x, y)) as TouchEvent;\n}\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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { EventEmitter, Injectable, NgZone } from '@angular/core';\n\nimport { NzSafeAny } from 'ng-zorro-antd/core/types';\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 *\n * @docs-private\n */\n@Injectable()\nexport class MockNgZone extends NgZone {\n  override onStable = new EventEmitter<NzSafeAny>(false);\n\n  constructor() {\n    super({ enableLongStackTrace: false });\n  }\n\n  override run(fn: () => NzSafeAny): NzSafeAny {\n    return fn();\n  }\n\n  override runOutsideAngular(fn: () => NzSafeAny): NzSafeAny {\n    return fn();\n  }\n\n  simulateZoneExit(): void {\n    this.onStable.emit(null);\n  }\n}\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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/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 *\n * @param value Value to be set on the input.\n * @param element Element onto which to set the value.\n */\nexport function typeInElement(value: string, element: HTMLInputElement | HTMLTextAreaElement): void {\n  element.focus();\n  element.value = value;\n  dispatchFakeEvent(element, 'input');\n}\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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport type { ComponentFixture } from '@angular/core/testing';\n\nexport function sleep(ms: number): Promise<void> {\n  return new Promise(resolve => setTimeout(resolve, ms));\n}\n\nexport async function updateNonSignalsInput<T>(fixture: ComponentFixture<T>, ms?: number): Promise<void> {\n  fixture.changeDetectorRef.markForCheck();\n  if (typeof ms === 'number') {\n    await sleep(ms);\n  }\n  await fixture.whenStable();\n}\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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nexport * from './directionality';\nexport * from './dispatch-events';\nexport * from './event-objects';\nexport * from './mock-ng-zone';\nexport * from './type-in-element';\nexport * from './zoneless-helpers';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;;AAGG;AAMH,MAAM,kBAAkB,CAAA;IACtB,KAAK,GAAG,KAAK;AACb,IAAA,MAAM,GAAG,IAAI,OAAO,EAAE;AACtB,IAAA,WAAW,GAAG,MAAM,CAAC,KAAK,uDAAC;AAC5B;SAEe,yBAAyB,GAAA;AACvC,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC9F;;ACjBA;;;AAGG;AAIH;AACM,SAAU,gBAAgB,CAAC,IAAY,EAAE,CAAA,GAAY,CAA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