{"version":3,"file":"ptsecurity-cdk-testing.mjs","sources":["../../../packages/cdk/testing/event-objects.ts","../../../packages/cdk/testing/dispatch-events.ts","../../../packages/cdk/testing/type-in-element.ts","../../../packages/cdk/testing/element-focus.ts","../../../packages/cdk/testing/mock-ng-zone.ts","../../../packages/cdk/testing/wrapped-error-message.ts","../../../packages/cdk/testing/ptsecurity-cdk-testing.ts"],"sourcesContent":["/** Creates a browser MouseEvent with the specified options. */\n// tslint:disable-next-line:no-reserved-keywords\nexport function createMouseEvent(type: string, x = 0, y = 0, button = 0) {\n    const event = document.createEvent('MouseEvent');\n\n    event.initMouseEvent(\n        type,\n        false,\n        false,\n        window, /* view */\n        0,\n        x, /* screenX */\n        y, /* screenY */\n        x, /* clientX */\n        y, /* clientY */\n        false,\n        false,\n        false,\n        false,\n        button, /* button */\n        null\n    );\n\n    return event;\n}\n\n/** Creates a browser TouchEvent with the specified pointer coordinates. */\n// tslint:disable-next-line:no-reserved-keywords\nexport function createTouchEvent(type: string, pageX = 0, pageY = 0) {\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 = document.createEvent('UIEvent');\n    const touchDetails = { pageX, pageY };\n\n    (event as any).initUIEvent(type, true, true, window, 0);\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    });\n\n    return event;\n}\n\n/** Dispatches a keydown event from an element. */\n// tslint:disable-next-line:no-reserved-keywords\nexport function createKeyboardEvent(type: string, keyCode: number, target?: Element, key?: string) {\n    const event = document.createEvent('KeyboardEvent') as any;\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    });\n\n    return event;\n}\n\n/** Creates a fake event object with any desired event type. */\n// tslint:disable-next-line:no-reserved-keywords\nexport function createFakeEvent(type: string, canBubble = false, cancelable = true) {\n    const event = document.createEvent('Event');\n    event.initEvent(type, canBubble, cancelable);\n\n    return event;\n}\n","// tslint:disable:no-reserved-keywords\n\nimport {\n    createFakeEvent,\n    createKeyboardEvent,\n    createMouseEvent,\n    createTouchEvent\n} from './event-objects';\n\n\n/** Utility to dispatch any event on a Node. */\nexport function dispatchEvent(node: Node | Window, event: Event): Event {\n    node.dispatchEvent(event);\n\n    return event;\n}\n\n/** Shorthand to dispatch a fake event on a specified node. */\n// tslint:disable-next-line:no-reserved-keywords\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):\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(\nnode: Node, type: string, x = 0, y = 0, event = 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. */\n// tslint:disable-next-line:no-reserved-keywords\nexport function dispatchTouchEvent(node: Node, type: string, x = 0, y = 0) {\n    return dispatchEvent(node, createTouchEvent(type, x, y));\n}\n","import { dispatchFakeEvent } from './dispatch-events';\n\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(value: string, element: HTMLInputElement) {\n    element.focus();\n    element.value = value;\n    dispatchFakeEvent(element, 'input');\n}\n","import { dispatchFakeEvent } from './dispatch-events';\n\n\n/**\n * Patches an elements focus and blur methods to emit events consistently and predictably.\n * This is necessary, because some browsers, like IE11, will call the focus handlers asynchronously,\n * while others won't fire them at all if the browser window is not focused.\n */\nexport function patchElementFocus(element: HTMLElement) {\n  element.focus = () => dispatchFakeEvent(element, 'focus');\n  element.blur = () => dispatchFakeEvent(element, 'blur');\n}\n","import { EventEmitter, Injectable, NgZone } from '@angular/core';\n\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    onStable: EventEmitter<any> = new EventEmitter(false);\n\n    constructor() {\n        super({enableLongStackTrace: false});\n    }\n\n    run(fn: () => void): any {\n        // tslint:disable-next-line\n        return fn();\n    }\n\n    runOutsideAngular(fn: () => void): any {\n        // tslint:disable-next-line\n        return fn();\n    }\n\n    simulateZoneExit(): void {\n        this.onStable.emit(null);\n    }\n}\n","export function wrappedErrorMessage(e: Error) {\n    const escapedMessage = e.message.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&');\n\n    return new RegExp(escapedMessage);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;AACA;AACgB,SAAA,gBAAgB,CAAC,IAAY,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAA;IACnE,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAEjD,KAAK,CAAC,cAAc,CAChB,IAAI,EACJ,KAAK,EACL,KAAK,EACL,MAAM,aACN,CAAC,EACD,CAAC,gBACD,CAAC,gBACD,CAAC,gBACD,CAAC,gBACD,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,M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