From 047b43c8484f87eba1101aa6859b968fc8fab5e1 Mon Sep 17 00:00:00 2001 From: kygoh Date: Fri, 13 Mar 2020 06:26:39 +0800 Subject: [PATCH 001/781] Exposed _shadow property in Leaflet.Marker class (#42788) --- types/leaflet/index.d.ts | 2 ++ types/leaflet/leaflet-tests.ts | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index f37400a65b..02cc918958 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -1906,6 +1906,8 @@ export class Marker

extends Layer { options: MarkerOptions; dragging?: Handler; feature?: geojson.Feature; + + protected _shadow: HTMLElement | undefined; } export function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker; diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index 5630ac49d8..7e052cf015 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -502,6 +502,16 @@ class MyMarker extends L.Marker { constructor() { super([12, 13]); } + + // adapted from Leaflet.AnimatedMarker + animate() { + const speed = 1000; + + if (L.DomUtil.TRANSITION) { + if (this.getElement()) { this.getElement().style.setProperty(L.DomUtil.TRANSITION, `all ${speed}ms linear`); } + if (this._shadow) { this._shadow.style.setProperty(L.DomUtil.TRANSITION, `all ${speed}ms linear`); } + } + } } class MyLayer extends L.Layer { From 391e0695905f2cb1343e51ba0562904eb845232b Mon Sep 17 00:00:00 2001 From: Philip Lucks Date: Thu, 12 Mar 2020 16:39:10 -0600 Subject: [PATCH 002/781] [react-phone-number-input] Add back in removed optional props: international & country (#42996) * added missing props * test * linting --- types/react-phone-number-input/index.d.ts | 21 +++++++++++++++++++ .../react-phone-number-input-tests.tsx | 2 ++ 2 files changed, 23 insertions(+) diff --git a/types/react-phone-number-input/index.d.ts b/types/react-phone-number-input/index.d.ts index 0645170f42..99d5629dbd 100644 --- a/types/react-phone-number-input/index.d.ts +++ b/types/react-phone-number-input/index.d.ts @@ -79,6 +79,14 @@ export interface PhoneInputProps extends Omit, * @example ["RU", "UA", "KZ"] */ countries?: string[]; + + /** + * If country is specified then the phone number can only be input in "national" + * (not "international") format, and will be parsed as a phone number belonging + * to the country. Example: country="US" + */ + country?: string; + /** * Can be used to place some countries on top of the list of country Date: Fri, 13 Mar 2020 07:50:03 +0900 Subject: [PATCH 007/781] [ioredis] Add lpop for Cluster (#43005) Co-authored-by: thmiyathmary --- types/ioredis/index.d.ts | 3 +++ types/ioredis/ioredis-tests.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 717cab4855..4d6828ffa2 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -1326,6 +1326,9 @@ declare namespace IORedis { rpushBuffer(key: string, ...values: Buffer[]): Promise; + lpop(key: KeyType, callback: (err: Error, res: string) => void): void; + lpop(key: KeyType): Promise; + lpopBuffer(key: KeyType, callback: (err: Error, res: Buffer) => void): void; lpopBuffer(key: KeyType): Promise; diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index cd19f613c0..8a59f7c4ae 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -278,6 +278,18 @@ cluster.decr('key', (err, data) => { // [null, '100'] }); +listData.forEach(value => { + cluster.rpush('bufferlist', Buffer.from(value)); +}); + +listData.forEach(value => { + cluster.lpop('bufferlist', (err, data) => { + if (data !== value) { + console.log(data); + } + }); +}); + listData.forEach(value => { cluster.rpushBuffer('bufferlist', Buffer.from(value)); }); From 9892146bf741a14fef790410a7f26be5e501e1a2 Mon Sep 17 00:00:00 2001 From: Aaron Zemetres Date: Thu, 12 Mar 2020 18:53:00 -0400 Subject: [PATCH 008/781] doc(jest-dom): describing matchers and examples (#43001) --- types/testing-library__jest-dom/index.d.ts | 348 +++++++++++++++++++++ 1 file changed, 348 insertions(+) diff --git a/types/testing-library__jest-dom/index.d.ts b/types/testing-library__jest-dom/index.d.ts index c56eaf7752..1423238a1a 100644 --- a/types/testing-library__jest-dom/index.d.ts +++ b/types/testing-library__jest-dom/index.d.ts @@ -12,25 +12,373 @@ declare namespace jest { interface Matchers { /** * @deprecated + * since v1.9.0 + * @description + * Assert whether a value is a DOM element, or not. Contrary to what its name implies, this matcher only checks + * that you passed to it a valid DOM element. + * + * It does not have a clear definition of what "the DOM" is. Therefore, it does not check whether that element + * is contained anywhere. + * @see + * [testing-library/jest-dom#toBeInTheDom](https:github.com/testing-library/jest-dom#toBeInTheDom) */ toBeInTheDOM(container?: HTMLElement | SVGElement): R; + /** + * @description + * Assert whether an element is present in the document or not. + * @example + * + * + * expect(queryByTestId('svg-element')).toBeInTheDocument() + * expect(queryByTestId('does-not-exist')).not.toBeInTheDocument() + * @see + * [testing-library/jest-dom#tobeinthedocument](https:github.com/testing-library/jest-dom#tobeinthedocument) + */ toBeInTheDocument(): R; + /** + * @description + * This allows you to check if an element is currently visible to the user. + * + * An element is visible if **all** the following conditions are met: + * * it does not have its css property display set to none + * * it does not have its css property visibility set to either hidden or collapse + * * it does not have its css property opacity set to 0 + * * its parent element is also visible (and so on up to the top of the DOM tree) + * * it does not have the hidden attribute + * * if `

` it has the open attribute + * @example + *
+ * Zero Opacity + *
+ * + *
Visible Example
+ * + * expect(getByTestId('zero-opacity')).not.toBeVisible() + * expect(getByTestId('visible')).toBeVisible() + * @see + * [testing-library/jest-dom#tobevisible](https:github.com/testing-library/jest-dom#tobevisible) + */ toBeVisible(): R; + /** + * @description + * Assert whether an element has content or not. + * @example + * + * + * + * + * expect(getByTestId('empty')).toBeEmpty() + * expect(getByTestId('not-empty')).not.toBeEmpty() + * @see + * [testing-library/jest-dom#tobeempty](https:github.com/testing-library/jest-dom#tobeempty) + */ toBeEmpty(): R; + /** + * @description + * Allows you to check whether an element is disabled from the user's perspective. + * + * Matches if the element is a form control and the `disabled` attribute is specified on this element or the + * element is a descendant of a form element with a `disabled` attribute. + * @example + * + * + * expect(getByTestId('button')).toBeDisabled() + * @see + * [testing-library/jest-dom#tobedisabled](https:github.com/testing-library/jest-dom#tobedisabled) + */ toBeDisabled(): R; + /** + * @description + * Allows you to check whether an element is not disabled from the user's perspective. + * + * Works like `not.toBeDisabled()`. + * + * Use this matcher to avoid double negation in your tests. + * @example + * + * + * expect(getByTestId('button')).toBeEnabled() + * @see + * [testing-library/jest-dom#tobeenabled](https:github.com/testing-library/jest-dom#tobeenabled) + */ toBeEnabled(): R; + /** + * @description + * Check if a form element, or the entire `form`, is currently invalid. + * + * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no + * value or a value of "true", or if the result of `checkValidity()` is false. + * @example + * + * + *
+ * + *
+ * + * expect(getByTestId('no-aria-invalid')).not.toBeInvalid() + * expect(getByTestId('invalid-form')).toBeInvalid() + * @see + * [testing-library/jest-dom#tobeinvalid](https:github.com/testing-library/jest-dom#tobeinvalid) + */ toBeInvalid(): R; + /** + * @description + * This allows you to check if a form element is currently required. + * + * An element is required if it is having a `required` or `aria-required="true"` attribute. + * @example + * + *
+ * + * expect(getByTestId('required-input')).toBeRequired() + * expect(getByTestId('supported-role')).not.toBeRequired() + * @see + * [testing-library/jest-dom#toberequired](https:github.com/testing-library/jest-dom#toberequired) + */ toBeRequired(): R; + /** + * @description + * Allows you to check if a form element is currently required. + * + * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no + * value or a value of "false", or if the result of `checkValidity()` is true. + * @example + * + * + *
+ * + *
+ * + * expect(getByTestId('no-aria-invalid')).not.toBeValid() + * expect(getByTestId('invalid-form')).toBeInvalid() + * @see + * [testing-library/jest-dom#tobevalid](https:github.com/testing-library/jest-dom#tobevalid) + */ toBeValid(): R; + /** + * @description + * Allows you to assert whether an element contains another element as a descendant or not. + * @example + * + * + * + * + * const ancestor = getByTestId('ancestor') + * const descendant = getByTestId('descendant') + * const nonExistantElement = getByTestId('does-not-exist') + * expect(ancestor).toContainElement(descendant) + * expect(descendant).not.toContainElement(ancestor) + * expect(ancestor).not.toContainElement(nonExistantElement) + * @see + * [testing-library/jest-dom#tocontainelement](https:github.com/testing-library/jest-dom#tocontainelement) + */ toContainElement(element: HTMLElement | SVGElement | null): R; + /** + * @description + * Assert whether a string representing a HTML element is contained in another element. + * @example + * + * + * + * + * const parent = getByTestId('parent') + * expect(parent).toContainerHTML() + * @see + * [testing-library/jest-dom#tocontainhtml](https:github.com/testing-library/jest-dom#tocontainhtml) + */ toContainHTML(htmlText: string): R; + /** + * @description + * Allows you to check if a given element has an attribute or not. + * + * You can also optionally check that the attribute has a specific expected value or partial match using + * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) or + * [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp). + * @example + * + * + * expect(button).toHaveAttribute('disabled') + * expect(button).toHaveAttribute('type', 'submit') + * expect(button).not.toHaveAttribute('type', 'button') + * @see + * [testing-library/jest-dom#tohaveattribute](https:github.com/testing-library/jest-dom#tohaveattribute) + */ toHaveAttribute(attr: string, value?: unknown): R; + /** + * @description + * Check whether the given element has certain classes within its `class` attribute. + * + * You must provide at least one class, unless you are asserting that an element does not have any classes. + * @example + * + * + *
no classes
+ * + * const deleteButton = getByTestId('delete-button') + * const noClasses = getByTestId('no-classes') + * expect(deleteButton).toHaveClass('btn') + * expect(deleteButton).toHaveClass('btn-danger xs') + * expect(noClasses).not.toHaveClass() + * @see + * [testing-library/jest-dom#tohaveclass](https:github.com/testing-library/jest-dom#tohaveclass) + */ toHaveClass(...classNames: string[]): R; + /** + * @description + * Assert whether an element has focus or not. + * @example + *
+ * + *
+ * + * const input = getByTestId('element-to-focus') + * input.focus() + * expect(input).toHaveFocus() + * input.blur() + * expect(input).not.toHaveFocus() + * @see + * [testing-library/jest-dom#tohavefocus](https:github.com/testing-library/jest-dom#tohavefocus) + */ toHaveFocus(): R; + /** + * @description + * Check if a form or fieldset contains form controls for each given name, and having the specified value. + * + * Can only be invoked on a form or fieldset element. + * @example + *
+ * + * + * + * + *
+ * + * expect(getByTestId('login-form')).toHaveFormValues({ + * username: 'jane.doe', + * rememberMe: true, + * }) + * @see + * [testing-library/jest-dom#tohaveformvalues](https:github.com/testing-library/jest-dom#tohaveformvalues) + */ toHaveFormValues(expectedValues: Record): R; + /** + * @description + * Check if an element has specific css properties with specific values applied. + * + * Only matches if the element has *all* the expected properties applied, not just some of them. + * @example + * + * + * const button = getByTestId('submit-button') + * expect(button).toHaveStyle('background-color: green') + * expect(button).toHaveStyle({ + * background-color: 'green', + * display: none + * }) + * @see + * [testing-library/jest-dom#tohavestyle](https:github.com/testing-library/jest-dom#tohavestyle) + */ toHaveStyle(css: string | Record): R; + /** + * @description + * Check whether the given element has a text content or not. + * + * When a string argument is passed through, it will perform a partial case-sensitive match to the element + * content. + * + * To perform a case-insensitive match, you can use a RegExp with the `/i` modifier. + * + * If you want to match the whole content, you can use a RegExp to do it. + * @example + * Text Content + * + * const element = getByTestId('text-content') + * expect(element).toHaveTextContent('Content') + * // to match the whole content + * expect(element).toHaveTextContent(/^Text Content$/) + * // to use case-insentive match + * expect(element).toHaveTextContent(/content$/i) + * expect(element).not.toHaveTextContent('content') + * @see + * [testing-library/jest-dom#tohavetextcontent](https:github.com/testing-library/jest-dom#tohavetextcontent) + */ toHaveTextContent(text: string | RegExp, options?: { normalizeWhitespace: boolean }): R; + /** + * @description + * Check whether the given form element has the specified value. + * + * Accepts ``, `