Skip to content

Commit 5f86abf

Browse files
authored
Merge pull request #6 from deinsoftware/dev
fixed by text function query
2 parents 51cad6a + 7d85e15 commit 5f86abf

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ Fixed for any bug fixes.
99
Security to invite users to upgrade in case of vulnerabilities.
1010
-->
1111

12+
## 0.0.7 - 2023/04/17
13+
14+
### Fixed
15+
16+
- by text function query
17+
1218
## 0.0.6 - 2023/04/17
1319

1420
### Added

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Below is a list of all available snippets and the triggers of each one. The `░
120120

121121
Sorted by recommended official priority
122122

123-
1. Role
123+
#### 1. Role
124124

125125
| Trigger | Result |
126126
| :------- | ----------------------------------------------------------------- |
@@ -132,19 +132,19 @@ Sorted by recommended official priority
132132
| `brh→` | `screen.░getByRole('heading')█` |
133133
| `brhl→` | `screen.░getByRole('heading', { level: ░<1\|2\|3\|4\|5\|6>} })█` |
134134

135-
4. Text
135+
#### 4. Text
136136

137-
| Trigger | Result |
138-
| :------- | ---------------------------------------------------------------- |
137+
| Trigger | Result |
138+
| :------- | ----------------------------------------------------------------- |
139139
| `bt→` | `screen.░getByText(░)█` |
140140
| `btf→` | `screen.░getByText('░Text Match')█` |
141141
| `bti→` | `screen.░getByText('░text match', {ignore: false})█` |
142142
| `bts→` | `screen.░getByText('░ext Matc', {exact: false})█` |
143143
| `btsi→` | `screen.░getByText('░ext matc', {exact: false, ignore: false})█` |
144144
| `btsw→` | `screen.░getByText((content) => content.startsWith('░Text'))█` |
145-
| `btesw→` | <code>screen.░getByText((content, element) => {<br/>&nbsp;&nbsp;return element.tagName.toLowerCase() === '░div' && content.startsWith('░Text')<br/>})█</code> |
145+
| `btesw→` | <code>screen.░getByText((content, element) => {<br/>&nbsp;&nbsp;const tag = element.tagName.toLowerCase() === '░div'<br/>&nbsp;&nbsp;return tag && content.startsWith('░Text')<br/>})█</code> |
146146
| `btew→` | `screen.░getByText((content) => content.endsWith('░Match'))█` |
147-
| `bteew→` | <code>screen.░getByText((content, element) => {<br/>&nbsp;&nbsp;return element.tagName.toLowerCase() === '░div' && content.endsWith('░Match')<br/>})█</code> |
147+
| `bteew→` | <code>screen.░getByText((content, element) => {<br/>&nbsp;&nbsp;const tag = element.tagName.toLowerCase() === '░div'<br/>&nbsp;&nbsp;return tag && content.endsWith('░Match')<br/>})█</code> |
148148

149149
### Debug
150150

snippets/queries.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
"prefix": "btesw",
9696
"body": [
9797
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text((content, element) => {",
98-
"\treturn element.tagName.toLowerCase() === '${2:div}' && content.startsWith('${3:Text}')",
98+
"\tconst tag = element.tagName.toLowerCase() === '${2:div}'",
99+
"\treturn tag && content.startsWith('${3:Text}')",
99100
"})"
100101
],
101102
"description": "Text query start with match on specific element"
@@ -111,7 +112,8 @@
111112
"prefix": "bteew",
112113
"body": [
113114
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text((content, element) => {",
114-
"\treturn element.tagName.toLowerCase() === '${2:div}' && content.endsWith('${3:Match}')",
115+
"\tconst tag = element.tagName.toLowerCase() === '${2:div}'",
116+
"\treturn tag && content.endsWith('${3:Match}')",
115117
"})"
116118
],
117119
"description": "Text query end with match on specific element"

0 commit comments

Comments
 (0)