diff --git a/src/__tests__/misc.js b/src/__tests__/misc.js
index 91c2ea4..cc59f72 100644
--- a/src/__tests__/misc.js
+++ b/src/__tests__/misc.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { Button, Picker, Switch, Text, View } from 'react-native';
+import { Button, Picker, Switch, Text, View, TextInput } from 'react-native';
import { toMatchDiffSnapshot } from 'snapshot-diff';
import { cleanup, fireEvent, render } from '../';
@@ -89,3 +89,28 @@ test('it finds by value={false}', () => {
getByDisplayValue(false);
});
+
+test("it finds by value={'hey'} when another a Switch with value={true} is present", () => {
+ const { getByDisplayValue } = render(
+
+
+
+ ,
+ );
+
+ getByDisplayValue('hey');
+});
+
+test("it finds by value={'java'} when another a Switch with value={true} is present", () => {
+ const { getByDisplayValue } = render(
+
+
+ setValue(itemValue)}>
+
+
+
+ ,
+ );
+
+ getByDisplayValue('java');
+});
diff --git a/src/lib/matches.js b/src/lib/matches.js
index c017338..5eefdea 100644
--- a/src/lib/matches.js
+++ b/src/lib/matches.js
@@ -1,5 +1,5 @@
function fuzzyMatches(textToMatch, node, matcher, normalizer) {
- if (typeof matcher === 'boolean') {
+ if (typeof matcher === 'boolean' || typeof textToMatch === 'boolean') {
return textToMatch == matcher;
}
@@ -18,7 +18,7 @@ function fuzzyMatches(textToMatch, node, matcher, normalizer) {
}
function matches(textToMatch, node, matcher, normalizer) {
- if (typeof matcher === 'boolean') {
+ if (typeof matcher === 'boolean' || typeof textToMatch === 'boolean') {
return textToMatch === matcher;
}