Skip to content

Commit 7bf62fb

Browse files
kdquistanchalalopenchiJoseLion
authored andcommitted
feat(native): Add toBeVisible (#145)
Co-authored-by: Carolina López <lopenchii@gmail.com> Co-authored-by: Jose Luis Leon <joseluis5000l@gmail.com> Co-authored-by: Carolina Lopez <calopez@twilio.com>
1 parent e8d657c commit 7bf62fb

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

packages/native/test/lib/ElementAssertion.test.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AssertionError, expect } from "@assertive-ts/core";
2-
import { render } from "@testing-library/react-native";
2+
import { fireEvent, render } from "@testing-library/react-native";
3+
import { useState, useCallback, ReactElement } from "react";
34
import {
45
View,
56
TextInput,
@@ -9,6 +10,26 @@ import {
910

1011
import { ElementAssertion } from "../../src/lib/ElementAssertion";
1112

13+
function SimpleToggleText(): ReactElement {
14+
const [isVisible, setIsVisible] = useState(true);
15+
16+
const handleToggle = useCallback((): void => {
17+
setIsVisible(prev => !prev);
18+
}, []);
19+
20+
return (
21+
<View>
22+
<Text style={{ display: isVisible ? "flex" : "none" }}>
23+
{"Toggle me!"}
24+
</Text>
25+
<Button
26+
title="Toggle Text"
27+
onPress={handleToggle}
28+
/>
29+
</View>
30+
);
31+
}
32+
1233
describe("[Unit] ElementAssertion.test.ts", () => {
1334
describe(".toBeDisabled", () => {
1435
context("when the element is TextInput", () => {

0 commit comments

Comments
 (0)