From 96573d94030324579b1eb101dd33ff55fefce7db Mon Sep 17 00:00:00 2001 From: Inbal Tish <33805983+Inbal-Tish@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:22:59 +0300 Subject: [PATCH 01/14] TextField - add margin btw bottom elements and char counter (#3185) * TestField - add margin btw bottom elements and char counter * TestField - add tests for changing validationMassage * fix margin condition * fix snap tests --- .../TextFieldScreen.spec.js.snap | 10 ++++++-- .../textField/__tests__/index.driver.spec.tsx | 25 +++++++++++++++++++ src/components/textField/index.tsx | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/demo/src/screens/__tests__/__snapshots__/TextFieldScreen.spec.js.snap b/demo/src/screens/__tests__/__snapshots__/TextFieldScreen.spec.js.snap index b3311c5eb7..59a61c4514 100644 --- a/demo/src/screens/__tests__/__snapshots__/TextFieldScreen.spec.js.snap +++ b/demo/src/screens/__tests__/__snapshots__/TextFieldScreen.spec.js.snap @@ -2205,6 +2205,7 @@ exports[`TextField Screen renders screen 1`] = ` } > { expect(textFieldDriver.getValidationMessage().exists()).toBe(!!defaultProps?.preset); }); + it('should render validationMessage if validationMessage passed and remove it when validationMessage is changed to undefined', () => { + const renderTree = render(); + const textFieldDriver = TextFieldDriver({renderTree, testID: TEXT_FIELD_TEST_ID}); + + expect(textFieldDriver.getValidationMessage().exists()).toBe(true); + expect(textFieldDriver.getValidationMessage().getText()).toEqual('mock message'); + + renderTree.rerender(); + + expect(textFieldDriver.getValidationMessage().exists()).toBe(false); + }); + + it('should not render validationMessage if validationMessage is undefined and add it when validationMessage is passed', () => { + const renderTree = render(); + const textFieldDriver = TextFieldDriver({renderTree, testID: TEXT_FIELD_TEST_ID}); + + expect(textFieldDriver.getValidationMessage().exists()).toBe(false); + + renderTree.rerender(); + + expect(textFieldDriver.getValidationMessage().exists()).toBe(true); + expect(textFieldDriver.getValidationMessage().getText()).toEqual('mock message'); + }); + + it('should render validationMessage on start if input required and validateOnStart passed', () => { const renderTree = render(); const textFieldDriver = TextFieldDriver({renderTree, testID: TEXT_FIELD_TEST_ID}); diff --git a/src/components/textField/index.tsx b/src/components/textField/index.tsx index 3fc4e308ab..e2e1ac8a53 100644 --- a/src/components/textField/index.tsx +++ b/src/components/textField/index.tsx @@ -209,7 +209,7 @@ const TextField = (props: InternalTextFieldProps) => { {/* */} - + {validationMessagePosition === ValidationMessagePosition.BOTTOM && ( Date: Mon, 29 Jul 2024 10:53:39 +0300 Subject: [PATCH 02/14] fix: broken links in docs (#3186) Co-authored-by: Ethan Sharabi <1780255+ethanshar@users.noreply.github.com> --- docs/foundation/modifiers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/foundation/modifiers.md b/docs/foundation/modifiers.md index fd8c874450..31b1d34cc4 100644 --- a/docs/foundation/modifiers.md +++ b/docs/foundation/modifiers.md @@ -112,9 +112,9 @@ The last type of modifiers is for styling your components ``` -! all styling modifiers are based on our [`Colors` & `Typography` presets](/docs/foundation/style). +! all styling modifiers are based on our [`Colors` & `Typography` presets](/docs/foundation/style.md). You can load your own presets and use them as modifiers. -Check out [this example](/docs/getting-started/usage) where we use most of these props. +Check out [this example](/docs/getting-started/usage.md) where we use most of these props. From 1efcf9761f709bf3726e578f09fb4a82661c5ca6 Mon Sep 17 00:00:00 2001 From: Ethan Sharabi <1780255+ethanshar@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:50:26 +0300 Subject: [PATCH 03/14] Revert "fix: broken links in docs (#3186)" (#3187) This reverts commit 318052002b4764fe4911ca9c816e626763fa04fa. --- docs/foundation/modifiers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/foundation/modifiers.md b/docs/foundation/modifiers.md index 31b1d34cc4..fd8c874450 100644 --- a/docs/foundation/modifiers.md +++ b/docs/foundation/modifiers.md @@ -112,9 +112,9 @@ The last type of modifiers is for styling your components ``` -! all styling modifiers are based on our [`Colors` & `Typography` presets](/docs/foundation/style.md). +! all styling modifiers are based on our [`Colors` & `Typography` presets](/docs/foundation/style). You can load your own presets and use them as modifiers. -Check out [this example](/docs/getting-started/usage.md) where we use most of these props. +Check out [this example](/docs/getting-started/usage) where we use most of these props. From df555a67cef3ca04cef5ae2912f06e27b7eb146c Mon Sep 17 00:00:00 2001 From: Inbal Tish <33805983+Inbal-Tish@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:40:28 +0300 Subject: [PATCH 04/14] TextField - show validation icon only with validation massage (#3189) --- src/components/textField/ValidationMessage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/textField/ValidationMessage.tsx b/src/components/textField/ValidationMessage.tsx index 8c6b5a3f95..1ed180f7da 100644 --- a/src/components/textField/ValidationMessage.tsx +++ b/src/components/textField/ValidationMessage.tsx @@ -39,7 +39,7 @@ const ValidationMessage = ({ if (validationIcon?.source) { return ( - {showValidationMessage && + {showValidationMessage && validationMessage && } {renderMessage()} From e74ea4cbc6531002c7eccdbe37162760c7b8a981 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:37:16 +0300 Subject: [PATCH 05/14] Bump fast-xml-parser from 4.3.6 to 4.4.1 (#3188) Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 4.3.6 to 4.4.1. - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v4.3.6...v4.4.1) --- updated-dependencies: - dependency-name: fast-xml-parser dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index bcf5d50ea5..38a19e9cb7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4204,9 +4204,9 @@ fast-levenshtein@^2.0.6: integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fast-xml-parser@^4.0.12: - version "4.3.6" - resolved "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.6.tgz#190f9d99097f0c8f2d3a0e681a10404afca052ff" - integrity sha512-M2SovcRxD4+vC493Uc2GZVcZaj66CCJhWurC4viynVSTvrpErCShNcDz1lAho6n9REQKvL/ll4A4/fw6Y9z8nw== + version "4.4.1" + resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz#86dbf3f18edf8739326447bcaac31b4ae7f6514f" + integrity sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw== dependencies: strnum "^1.0.5" From 684fa1b05b053de8b9d2d7f75ed557ac456d074d Mon Sep 17 00:00:00 2001 From: Miki Leib <38354019+M-i-k-e-l@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:17:21 +0300 Subject: [PATCH 06/14] Remove some old unused drivers (#3190) --- src/components/button/Button.driver.ts | 36 ----------- src/components/carousel/Carousel.driver.ts | 7 --- src/components/picker/Picker.driver.ts | 7 --- .../sortableList/SortableListItem.driver.ts | 36 ----------- src/incubator/Dialog/__tests__/index.spec.tsx | 60 ------------------- 5 files changed, 146 deletions(-) delete mode 100644 src/components/button/Button.driver.ts delete mode 100644 src/components/carousel/Carousel.driver.ts delete mode 100644 src/components/picker/Picker.driver.ts delete mode 100644 src/components/sortableList/SortableListItem.driver.ts delete mode 100644 src/incubator/Dialog/__tests__/index.spec.tsx diff --git a/src/components/button/Button.driver.ts b/src/components/button/Button.driver.ts deleted file mode 100644 index eb609483f3..0000000000 --- a/src/components/button/Button.driver.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {ButtonProps} from './types'; -import {ImageDriver} from '../image/Image.driver'; -import {ComponentDriver, ComponentDriverArgs} from '../../testkit/Component.driver'; -import {TextDriver} from '../text/Text.driver'; - -/** - * Please run clear after each test - */ -export class ButtonDriver extends ComponentDriver { - private readonly labelDriver: TextDriver; - private readonly iconDriver: ImageDriver; - - constructor(componentDriverArgs: ComponentDriverArgs) { - super(componentDriverArgs); - - this.labelDriver = new TextDriver({...componentDriverArgs, testID: `${this.testID}.label`}); - this.iconDriver = new ImageDriver({...componentDriverArgs, testID: `${this.testID}.icon`}); - } - - isPressable = async () => { - if (await this.exists()) { - return typeof (await this.getElementProps()).onPress === 'function'; - } else { - console.warn(`TextDriver: cannot click because testID:${this.testID} were not found`); - return null; - } - }; - - // label - getLabelRootElement = () => this.labelDriver.getElement(); - isLabelExists = () => this.labelDriver.exists(); - getLabelContent = () => this.labelDriver.getTextContent(); - // icon - getIconElement = () => this.iconDriver.getElement(); - isIconExists = () => this.iconDriver.exists(); -} diff --git a/src/components/carousel/Carousel.driver.ts b/src/components/carousel/Carousel.driver.ts deleted file mode 100644 index 0b8303a920..0000000000 --- a/src/components/carousel/Carousel.driver.ts +++ /dev/null @@ -1,7 +0,0 @@ -import {CarouselProps} from './types'; -import {ComponentDriver} from '../../testkit/Component.driver'; - -export class CarouselDriver extends ComponentDriver { - getContentOffset = async () => (await this.getElementProps()).contentOffset; - scroll = async (delta: number) => (await this.uniDriver.selectorByTestId(this.testID)).scrollX(delta); -} diff --git a/src/components/picker/Picker.driver.ts b/src/components/picker/Picker.driver.ts deleted file mode 100644 index 6056991456..0000000000 --- a/src/components/picker/Picker.driver.ts +++ /dev/null @@ -1,7 +0,0 @@ -import {PickerProps} from './types'; -import {ComponentDriver} from '../../testkit/Component.driver'; - -export class PickerDriver extends ComponentDriver { - getPickerOverlay = async () => await this.getByTestId(`${this.testID}.overlay`); - getPickerOverlayProps = async () => await this.getPropsByTestId(`${this.testID}.overlay`); -} diff --git a/src/components/sortableList/SortableListItem.driver.ts b/src/components/sortableList/SortableListItem.driver.ts deleted file mode 100644 index 0e14a50bb4..0000000000 --- a/src/components/sortableList/SortableListItem.driver.ts +++ /dev/null @@ -1,36 +0,0 @@ -import _ from 'lodash'; -import {SortableListProps, SortableListItemProps} from './types'; -import {ComponentDriver} from '../../testkit/Component.driver'; - -/** - * Please run clear after each test - */ -export class SortableListItemDriver extends ComponentDriver> { - dragUp = async (indices: number) => { - this.validateIndices(indices); - const data = _.times(indices, index => { - return { - translationY: -52 * (index + 1) - }; - }); - - await this.uniDriver.selectorByTestId(this.testID).then(driver => driver.drag(data)); - }; - - dragDown = async (indices: number) => { - this.validateIndices(indices); - const data = _.times(indices, index => { - return { - translationY: 52 * (index + 1) - }; - }); - - await this.uniDriver.selectorByTestId(this.testID).then(driver => driver.drag(data)); - }; - - private validateIndices = (indices: number) => { - if (indices <= 0 || !Number.isInteger(indices)) { - throw Error('indices must be a positive integer'); - } - }; -} diff --git a/src/incubator/Dialog/__tests__/index.spec.tsx b/src/incubator/Dialog/__tests__/index.spec.tsx deleted file mode 100644 index b2432bb7a3..0000000000 --- a/src/incubator/Dialog/__tests__/index.spec.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import React, {useCallback, useEffect, useState} from 'react'; -import Button from '../../../components/button'; -import View from '../../../components/view'; -import Dialog from '../index'; -import {ComponentDriver} from '../../../testkit/Component.driver'; -import {ButtonDriver} from '../../../components/button/Button.driver'; - -const onDismiss = () => {}; - -const defaultProps = { - testID: 'dialog', - useSafeArea: true, - onDismiss, - bottom: true, - centerH: true -}; - -const TestCase = props => { - const [visible, setVisible] = useState(props.visible); - - useEffect(() => { - setVisible(props.visible); - }, [props.visible]); - - const openDialog = useCallback(() => { - setVisible(true); - }, []); - - const closeDialog = useCallback(() => { - setVisible(false); - }, []); - - return ( - - - - -