From a9d0f2aeaed9060a3a12ad62b4255e9ab18688b7 Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Thu, 4 Nov 2021 13:34:55 -0700 Subject: [PATCH] docs(cdk/testing): expand JsDoc for sendKeys with limitations This change is in response to feedback that it's not obvious that `TestElement.sendKeys` may behave differently in different environments. To help a tiny bit, we expand the JsDoc for `sendKeys` to mentions that it cannot reproduce native keyboard shortcuts in all environments. --- src/cdk/testing/test-element.ts | 3 ++- src/cdk/testing/testbed/unit-test-element.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cdk/testing/test-element.ts b/src/cdk/testing/test-element.ts index 98f090f93720..844a94925756 100644 --- a/src/cdk/testing/test-element.ts +++ b/src/cdk/testing/test-element.ts @@ -117,7 +117,8 @@ export interface TestElement { /** * Sends the given string to the input as a series of key presses. Also fires input events - * and attempts to add the string to the Element's value. + * and attempts to add the string to the Element's value. Note that some environments cannot + * reproduce native browser behavior for keyboard shortcuts such as Tab, Ctrl + A, etc. */ sendKeys(...keys: (string | TestKey)[]): Promise; diff --git a/src/cdk/testing/testbed/unit-test-element.ts b/src/cdk/testing/testbed/unit-test-element.ts index 40167f5dbfa5..625db121c3f7 100644 --- a/src/cdk/testing/testbed/unit-test-element.ts +++ b/src/cdk/testing/testbed/unit-test-element.ts @@ -148,7 +148,8 @@ export class UnitTestElement implements TestElement { /** * Sends the given string to the input as a series of key presses. Also fires input events - * and attempts to add the string to the Element's value. + * and attempts to add the string to the Element's value. Note that this cannot + * reproduce native browser behavior for keyboard shortcuts such as Tab, Ctrl + A, etc. */ async sendKeys(...keys: (string | TestKey)[]): Promise; /**