Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Fixed for any bug fixes.
Security to invite users to upgrade in case of vulnerabilities.
-->

## 0.0.7 - 2023/04/17

### Fixed

- by text function query

## 0.0.6 - 2023/04/17

### Added
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Below is a list of all available snippets and the triggers of each one. The `░

Sorted by recommended official priority

1. Role
#### 1. Role

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

4. Text
#### 4. Text

| Trigger | Result |
| :------- | ---------------------------------------------------------------- |
| Trigger | Result |
| :------- | ----------------------------------------------------------------- |
| `bt→` | `screen.░getByText(░)█` |
| `btf→` | `screen.░getByText('░Text Match')█` |
| `bti→` | `screen.░getByText('░text match', {ignore: false})█` |
| `bts→` | `screen.░getByText('░ext Matc', {exact: false})█` |
| `btsi→` | `screen.░getByText('░ext matc', {exact: false, ignore: false})█` |
| `btsw→` | `screen.░getByText((content) => content.startsWith('░Text'))█` |
| `btesw→` | <code>screen.░getByText((content, element) => {<br/>&nbsp;&nbsp;return element.tagName.toLowerCase() === '░div' && content.startsWith('░Text')<br/>})█</code> |
| `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> |
| `btew→` | `screen.░getByText((content) => content.endsWith('░Match'))█` |
| `bteew→` | <code>screen.░getByText((content, element) => {<br/>&nbsp;&nbsp;return element.tagName.toLowerCase() === '░div' && content.endsWith('░Match')<br/>})█</code> |
| `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> |

### Debug

Expand Down
6 changes: 4 additions & 2 deletions snippets/queries.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
"prefix": "btesw",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text((content, element) => {",
"\treturn element.tagName.toLowerCase() === '${2:div}' && content.startsWith('${3:Text}')",
"\tconst tag = element.tagName.toLowerCase() === '${2:div}'",
"\treturn tag && content.startsWith('${3:Text}')",
"})"
],
"description": "Text query start with match on specific element"
Expand All @@ -111,7 +112,8 @@
"prefix": "bteew",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text((content, element) => {",
"\treturn element.tagName.toLowerCase() === '${2:div}' && content.endsWith('${3:Match}')",
"\tconst tag = element.tagName.toLowerCase() === '${2:div}'",
"\treturn tag && content.endsWith('${3:Match}')",
"})"
],
"description": "Text query end with match on specific element"
Expand Down