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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"itrh",
"itue",
"paypal",
"sltp",
"volta"
],
"markdownlint.config": {
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.0.3 - 2023/04/05

### Added

- debug snippets

## 0.0.2 - 2023/04/05

### Added
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ 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'█` |
| 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'█` |

### User Event

Expand All @@ -100,6 +100,13 @@ Below is a list of all available snippets and the triggers of each one. The `░
| `gabr→` | `screen.getAllByRole('░id')█` |
| `gabro→` | `screen.getAllByRole('░id', {░})█` |

### Debug

| Trigger | Result |
| -------: | ------------------------------------ |
| `sd→` | `screen.debug()█` |
| `sltp→` | `screen.logTestingPlaygroundURL()█` |

⇧ [Back to menu](#menu)

---
Expand Down
22 changes: 21 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "testing-library-snippets",
"description": "VS Code Testing Library snippets for JS and TS",
"version": "0.0.2",
"version": "0.0.3",
"displayName": "Testing Library Snippets",
"publisher": "deinsoftware",
"icon": "images/light-icon.png",
Expand Down Expand Up @@ -54,6 +54,10 @@
"language": "javascript",
"path": "./snippets/queries.json"
},
{
"language": "javascript",
"path": "./snippets/debug.json"
},
{
"language": "javascriptreact",
"path": "./snippets/import.json"
Expand All @@ -66,6 +70,10 @@
"language": "javascriptreact",
"path": "./snippets/queries.json"
},
{
"language": "javascriptreact",
"path": "./snippets/debug.json"
},
{
"language": "vue",
"path": "./snippets/import.json"
Expand All @@ -78,6 +86,10 @@
"language": "vue",
"path": "./snippets/queries.json"
},
{
"language": "vue",
"path": "./snippets/debug.json"
},
{
"language": "typescript",
"path": "./snippets/import.json"
Expand All @@ -90,6 +102,10 @@
"language": "typescript",
"path": "./snippets/queries.json"
},
{
"language": "typescript",
"path": "./snippets/debug.json"
},
{
"language": "typescriptreact",
"path": "./snippets/import.json"
Expand All @@ -101,6 +117,10 @@
{
"language": "typescriptreact",
"path": "./snippets/queries.json"
},
{
"language": "typescriptreact",
"path": "./snippets/debug.json"
}
]
},
Expand Down
12 changes: 12 additions & 0 deletions snippets/debug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"screen.debug": {
"prefix": "sd",
"body": "screen.debug()$0",
"description": "screen debug"
},
"screen.log.testing-playground": {
"prefix": "sltp",
"body": "screen.logTestingPlaygroundURL()$0",
"description": "screen log testing playground url"
}
}
2 changes: 2 additions & 0 deletions test/snippets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { it, expect, describe } from 'vitest'
const importSnippets = require("../snippets/import.json")
const userEventSnippets = require("../snippets/user-event.json")
const queriesSnippets = require("../snippets/queries.json")
const debugSnippets = require("../snippets/debug.json")

const snippets = {
...importSnippets,
...userEventSnippets,
...queriesSnippets,
...debugSnippets,
}

const unique = (xs) => [...new Set(xs)]
Expand Down