From 7d85e1531bb4e260a6f90feb3790a97b8d844eff Mon Sep 17 00:00:00 2001 From: equiman Date: Mon, 17 Apr 2023 19:19:32 -0500 Subject: [PATCH] fixed by text function query --- CHANGELOG.md | 6 ++++++ README.md | 12 ++++++------ snippets/queries.json | 6 ++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e356ea..4bc6628 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index b1da5e0..f705a7d 100644 --- a/README.md +++ b/README.md @@ -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 | | :------- | ----------------------------------------------------------------- | @@ -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→` | screen.░getByText((content, element) => {
  return element.tagName.toLowerCase() === '░div' && content.startsWith('░Text')
})█
| +| `btesw→` | screen.░getByText((content, element) => {
  const tag = element.tagName.toLowerCase() === '░div'
  return tag && content.startsWith('░Text')
})█
| | `btew→` | `screen.░getByText((content) => content.endsWith('░Match'))█` | -| `bteew→` | screen.░getByText((content, element) => {
  return element.tagName.toLowerCase() === '░div' && content.endsWith('░Match')
})█
| +| `bteew→` | screen.░getByText((content, element) => {
  const tag = element.tagName.toLowerCase() === '░div'
  return tag && content.endsWith('░Match')
})█
| ### Debug diff --git a/snippets/queries.json b/snippets/queries.json index f7a057b..b3d904a 100644 --- a/snippets/queries.json +++ b/snippets/queries.json @@ -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" @@ -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"