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
28 changes: 14 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"cSpell.words": [
"beus",
"brc",
"brcc",
"brh",
"brhl",
"bro",
"bron",
"bteew",
"btesw",
"btew",
"btf",
"bti",
"bts",
"btsi",
"btsw",
"qrc",
"qrcc",
"qrh",
"qrhl",
"qro",
"qron",
"qteew",
"qtesw",
"qtew",
"qtf",
"qti",
"qts",
"qtsi",
"qtsw",
"deinsoftware",
"Equiman",
"ithub",
Expand Down
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.1.0 - 2023/04/18

### Changed

- rename all the query snippets

## 0.0.10 - 2023/04/18

### Changed
Expand Down
60 changes: 30 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Open the extension manager with <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>X</kbd> (W

## Cheat Sheet

You can write any combination of **Search variants** and **Search types**.
You can write queries with any combination of **Search variants** and **Search types**.

### Search variants

Expand Down Expand Up @@ -113,48 +113,48 @@ Below is a list of all available snippets and the triggers of each one. The `░
### Import

| Trigger | Result |
| -------: | ------------------------------------------------------------------- |
| `itl→` | `import { render, screen } from '@testing-library/░<react\|vue>'█` |
| `itr→` | `import { render, screen } from '@testing-library/react'█` |
| `itv→` | `import { render, screen } from '@testing-library/vue'█` |
| `itrh→` | `import { renderHook } from '@testing-library/react'█` |
| `itue→` | `import user from '@testing-library/user-event'█` |
| :------- | ------------------------------------------------------------------- |
| `itl→` | `import { render, screen } from '@testing-library/░<react\|vue>'█` |
| `itr→` | `import { render, screen } from '@testing-library/react'█` |
| `itv→` | `import { render, screen } from '@testing-library/vue'█` |
| `itrh→` | `import { renderHook } from '@testing-library/react'█` |
| `itue→` | `import user from '@testing-library/user-event'█` |

### User Event

| Trigger | Result |
| -------: | ---------------------------------------------------------------------- |
| `beus→` | <code>beforeEach(() => {<br/>&nbsp;&nbsp;user.setup()<br/>})█</code> |
| :------- | ---------------------------------------------------------------------- |
| `beus→` | <code>beforeEach(() => {<br/>&nbsp;&nbsp;user.setup()<br/>})█</code> |

### Queries

All the query `░variant` start with `getBy` by default, but can be easily changed between `<getBy|getAllBy|queryBy|queryAllBy|findBy|findByAll>` once reach the TAB position.
All the `░variantBy` cursor start with `getBy` by default, but can be easily changed between `<getBy|getAllBy|queryBy|queryAllBy|findBy|findByAll>` using arrow keys once reach the TAB position.

#### 1. Role

| Trigger | Result |
| :------- | ------------------------------------------------------------------- |
| `br→` | `screen.░variantRole('░id')█` |
| `bro→` | `screen.░variantRole('░id', {░})█` |
| `bron→` | `screen.░variantRole('░id', {name: ░})█` |
| `brc→` | `screen.░variantRole('checkbox')█` |
| `brcc→` | <code>screen.░variantRole('checkbox', { checked: ░<true&#124;false>} )█</code> |
| `brh→` | `screen.░variantRole('heading')█` |
| `brhl→` | <code>screen.░variantRole('heading', { level: ░<1&#124;2&#124;3&#124;4&#124;5&#124;6>} )█</code> |
| Trigger | Result |
| :------- | ------------------------------------------------------------------------------------------------- |
| `qr→` | `screen.░variantByRole('░id')█` |
| `qro→` | `screen.░variantByRole('░id', {░})█` |
| `qron→` | `screen.░variantByRole('░id', {name: ░})█` |
| `qrc→` | `screen.░variantByRole('checkbox')█` |
| `qrcc→` | <code>screen.░variantByRole('checkbox', { checked: ░<true&#124;false>} )█</code> |
| `qrh→` | `screen.░variantByRole('heading')█` |
| `qrhl→` | <code>screen.░variantByRole('heading', { level: ░<1&#124;2&#124;3&#124;4&#124;5&#124;6>} )█</code> |

#### 4. Text

| Trigger | Result |
| :------- | ----------------------------------------------------------------- |
| `bt→` | `screen.░variantText(░)█` |
| `btf→` | `screen.░variantText('░Text Match')█` |
| `bti→` | `screen.░variantText('░text match', {ignore: false})█` |
| `bts→` | `screen.░variantText('░ext Matc', {exact: false})█` |
| `btsi→` | `screen.░variantText('░ext matc', {exact: false, ignore: false})█` |
| `btsw→` | `screen.░variantText((content) => content.startsWith('░Text'))█` |
| `btesw→` | <code>screen.░variantText((content, element) => {<br/>&nbsp;&nbsp;const tag = element.tagName.toLowerCase() === '░div'<br/>&nbsp;&nbsp;return tag && content.startsWith('░Text')<br/>})█</code> |
| `btew→` | `screen.░variantText((content) => content.endsWith('░Match'))█` |
| `bteew→` | <code>screen.░variantText((content, element) => {<br/>&nbsp;&nbsp;const tag = element.tagName.toLowerCase() === '░div'<br/>&nbsp;&nbsp;return tag && content.endsWith('░Match')<br/>})█</code> |
| Trigger | Result |
| :------- | ------------------------------------------------------------------- |
| `qt→` | `screen.░variantByText(░)█` |
| `qtf→` | `screen.░variantByText('░Text Match')█` |
| `qti→` | `screen.░variantByText('░text match', {ignore: false})█` |
| `qts→` | `screen.░variantByText('░ext Matc', {exact: false})█` |
| `qtsi→` | `screen.░variantByText('░ext matc', {exact: false, ignore: false})█` |
| `qtsw→` | `screen.░variantByText((content) => content.startsWith('░Text'))█` |
| `qtesw→` | <code>screen.░variantByText((content, element) => {<br/>&nbsp;&nbsp;const tag = element.tagName.toLowerCase() === '░div'<br/>&nbsp;&nbsp;return tag && content.startsWith('░Text')<br/>})█</code> |
| `qtew→` | `screen.░variantByText((content) => content.endsWith('░Match'))█` |
| `qteew→` | <code>screen.░variantByText((content, element) => {<br/>&nbsp;&nbsp;const tag = element.tagName.toLowerCase() === '░div'<br/>&nbsp;&nbsp;return tag && content.endsWith('░Match')<br/>})█</code> |

### Debug

Expand Down
64 changes: 32 additions & 32 deletions snippets/queries.json
Original file line number Diff line number Diff line change
@@ -1,98 +1,98 @@
{
"by.role": {
"prefix": "br",
"query.role": {
"prefix": "qr",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Role('${2:id}')$0"
],
"description": "Role query"
},
"by.role.options": {
"prefix": "bro",
"query.role.options": {
"prefix": "qro",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Role('${2:id}', {$3})$0"
],
"description": "Role query with options"
},
"by.role.options.name": {
"prefix": "bron",
"query.role.options.name": {
"prefix": "qron",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Role('${2:id}',\t{$3})$0"
],
"description": "Role query with name on options"
},
"by.role.checkbox": {
"prefix": "brc",
"query.role.checkbox": {
"prefix": "qrc",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Role('checkbox')$0"
],
"description": "Role checkbox"
},
"by.role.checkbox.checked": {
"prefix": "brcc",
"query.role.checkbox.checked": {
"prefix": "qrcc",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Role('checkbox', { checked: ${2|true,false|} })$0"
],
"description": "Role checkbox checked"
},
"by.role.heading": {
"prefix": "brh",
"query.role.heading": {
"prefix": "qrh",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Role('heading')$0"
],
"description": "Role heading"
},
"by.role.heading.level": {
"prefix": "brhl",
"query.role.heading.level": {
"prefix": "qrhl",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Role('heading', { level: ${2|1,2,3,4,5,6|} })$0"
],
"description": "Role heading level"
},

"by.text": {
"prefix": "bt",
"query.text": {
"prefix": "qt",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text($2)$0"
],
"description": "Text query"
},
"by.text.full": {
"prefix": "btf",
"query.text.full": {
"prefix": "qtf",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text('${2:Text Match}')$0"
],
"description": "Text query full string match"
},
"by.text.ignore": {
"prefix": "bti",
"query.text.ignore": {
"prefix": "qti",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text('${2:text match}', {ignore: false})$0"
],
"description": "Text query full string ignore case"
},
"by.text.substring": {
"prefix": "bts",
"query.text.substring": {
"prefix": "qts",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text('${2:ext Matc}', {exact: false})$0"
],
"description": "Text query substring match"
},
"by.text.substring+ignore": {
"prefix": "btsi",
"query.text.substring+ignore": {
"prefix": "qtsi",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text('${2:ext matc}', {exact: false, ignore: false})$0"
],
"description": "Text query substring match ignore case"
},
"by.text.startWith": {
"prefix": "btsw",
"query.text.startWith": {
"prefix": "qtsw",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text((content) => content.startsWith('${2:Text}'))$0"
],
"description": "Text query start with match"
},
"by.text.element.startWith": {
"prefix": "btesw",
"query.text.element.startWith": {
"prefix": "qtesw",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text((content, element) => {",
"\tconst tag = element.tagName.toLowerCase() === '${2:div}'",
Expand All @@ -101,15 +101,15 @@
],
"description": "Text query start with match on specific element"
},
"by.text.endWith": {
"prefix": "btew",
"query.text.endWith": {
"prefix": "qtew",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text((content) => content.endsWith('${2:Match}'))$0"
],
"description": "Text query end with match"
},
"by.text.element.endWith": {
"prefix": "bteew",
"query.text.element.endWith": {
"prefix": "qteew",
"body": [
"screen.${1|getBy,getAllBy,queryBy,queryAllBy,findBy,findByAll|}Text((content, element) => {",
"\tconst tag = element.tagName.toLowerCase() === '${2:div}'",
Expand Down