zds-pickers 4.0.5 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +19 -0
- package/.github/workflows/codeql-analysis.yml +67 -0
- package/.nvmrc +1 -0
- package/.prettierignore +0 -0
- package/.prettierrc +13 -0
- package/.storybook/main.ts +42 -0
- package/.storybook/manager.ts +12 -0
- package/.storybook/preview.tsx +26 -0
- package/.vscode/extensions.json +32 -0
- package/.vscode/javascript.code-snippets +229 -0
- package/.vscode/settings.json +358 -0
- package/biome.jsonc +158 -0
- package/dist/index.es.js +3 -1
- package/dist/types/index.d.ts +266 -2
- package/dist/types/pickers/CCPicker.d.ts +2 -1
- package/dist/types/pickers/ChannelMappingPicker.d.ts +2 -1
- package/dist/types/pickers/ChannelPicker.d.ts +5 -3
- package/dist/types/pickers/LatchPicker.d.ts +5 -3
- package/dist/types/pickers/MappingPicker.d.ts +2 -1
- package/dist/types/pickers/NotePicker.d.ts +2 -1
- package/dist/types/pickers/PolarityPicker.d.ts +6 -4
- package/dist/types/pickers/ResponseCurve.d.ts +14 -5
- package/dist/types/pickers/ResponseCurvePicker.d.ts +6 -4
- package/dist/types/pickers/StatusPicker.d.ts +2 -1
- package/dist/types/pickers/ValuePicker.d.ts +2 -1
- package/lib/@types/nebiru-react-rotary-knob.d.ts +20 -0
- package/lib/@types/react-svgmt.d.ts +74 -0
- package/lib/@types/zds-mappings.d.ts +55 -0
- package/lib/@types/zds-react-piano.d.ts +17 -0
- package/lib/hooks/useComponentSize.ts +52 -0
- package/lib/hooks/useStateWithDynamicDefault.ts +13 -0
- package/lib/main.ts +34 -0
- package/lib/midi/ccValues.ts +139 -0
- package/lib/midi/export.ts +54 -0
- package/lib/other/DefaultTooltip.ts +14 -0
- package/lib/other/OctavePlayer.tsx +141 -0
- package/lib/other/SVGText.tsx +221 -0
- package/lib/other/SoundFontProvider.tsx +130 -0
- package/lib/pickers/CCPicker.tsx +28 -0
- package/lib/pickers/ChannelMappingPicker.tsx +135 -0
- package/lib/pickers/ChannelPicker.tsx +76 -0
- package/lib/pickers/Knob.tsx +93 -0
- package/lib/pickers/KnobPicker.tsx +93 -0
- package/lib/pickers/LatchPicker.tsx +33 -0
- package/lib/pickers/MappingPicker.tsx +68 -0
- package/lib/pickers/NotePicker.tsx +95 -0
- package/lib/pickers/PianoPicker.tsx +77 -0
- package/lib/pickers/PolarityPicker.tsx +39 -0
- package/lib/pickers/ResponseCurve.tsx +304 -0
- package/lib/pickers/ResponseCurvePicker.tsx +74 -0
- package/lib/pickers/Select.tsx +248 -0
- package/lib/pickers/StatusPicker.tsx +28 -0
- package/lib/pickers/ValuePicker.tsx +67 -0
- package/lib/pickers/knobSkin10.tsx +94 -0
- package/lib/rotaryKnob/InternalInput.tsx +43 -0
- package/lib/rotaryKnob/Types.ts +6 -0
- package/lib/rotaryKnob/helpers/DrawCircle.tsx +41 -0
- package/lib/rotaryKnob/helpers/DrawLine.tsx +32 -0
- package/lib/rotaryKnob/helpers/HelpersOverlay.tsx +43 -0
- package/lib/rotaryKnob/helpers/KnobVisualHelpers.tsx +138 -0
- package/lib/rotaryKnob/index.tsx +417 -0
- package/lib/rotaryKnob/knobdefaultskin.ts +56 -0
- package/lib/rotaryKnob/utils.ts +112 -0
- package/lib/temp/acoustic_grand_piano-mp3.js +94 -0
- package/lib/utils.ts +41 -0
- package/package.json +2 -6
- package/stories/assets/sampleStyles.css +349 -0
- package/stories/assets/utils.js +7 -0
- package/stories/picker.stories.tsx +313 -0
- package/tsconfig.app.json +26 -0
- package/tsconfig.json +34 -0
- package/tsconfig.node.json +24 -0
- package/vite.config.ts +45 -0
- package/dist/index.d.ts +0 -244
package/.editorconfig
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# EditorConfig is awesome: http://EditorConfig.org
|
|
2
|
+
|
|
3
|
+
# https://github.com/jokeyrhyme/standard-editorconfig
|
|
4
|
+
|
|
5
|
+
# top-most EditorConfig file
|
|
6
|
+
root = true
|
|
7
|
+
|
|
8
|
+
# defaults
|
|
9
|
+
[*]
|
|
10
|
+
charset = utf-8
|
|
11
|
+
end_of_line = lf
|
|
12
|
+
insert_final_newline = true
|
|
13
|
+
trim_trailing_whitespace = true
|
|
14
|
+
indent_size = 2
|
|
15
|
+
indent_style = space
|
|
16
|
+
|
|
17
|
+
[*.md]
|
|
18
|
+
trim_trailing_whitespace = false
|
|
19
|
+
max_line_length = 200
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ master ]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [ master ]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '34 5 * * 0'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
|
|
28
|
+
strategy:
|
|
29
|
+
fail-fast: false
|
|
30
|
+
matrix:
|
|
31
|
+
language: [ 'javascript' ]
|
|
32
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
|
33
|
+
# Learn more:
|
|
34
|
+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- name: Checkout repository
|
|
38
|
+
uses: actions/checkout@v2
|
|
39
|
+
|
|
40
|
+
# Initializes the CodeQL tools for scanning.
|
|
41
|
+
- name: Initialize CodeQL
|
|
42
|
+
uses: github/codeql-action/init@v1
|
|
43
|
+
with:
|
|
44
|
+
languages: ${{ matrix.language }}
|
|
45
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
46
|
+
# By default, queries listed here will override any specified in a config file.
|
|
47
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
48
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
49
|
+
|
|
50
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
51
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
52
|
+
- name: Autobuild
|
|
53
|
+
uses: github/codeql-action/autobuild@v1
|
|
54
|
+
|
|
55
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
56
|
+
# 📚 https://git.io/JvXDl
|
|
57
|
+
|
|
58
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
59
|
+
# and modify them (or add more) to build your code if your project
|
|
60
|
+
# uses a compiled language
|
|
61
|
+
|
|
62
|
+
#- run: |
|
|
63
|
+
# make bootstrap
|
|
64
|
+
# make release
|
|
65
|
+
|
|
66
|
+
- name: Perform CodeQL Analysis
|
|
67
|
+
uses: github/codeql-action/analyze@v1
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
22.13.0
|
package/.prettierignore
ADDED
|
File without changes
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/react-vite'
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: ['../stories/*.stories.tsx'],
|
|
5
|
+
|
|
6
|
+
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
|
|
7
|
+
|
|
8
|
+
framework: {
|
|
9
|
+
name: '@storybook/react-vite',
|
|
10
|
+
options: {},
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
core: {
|
|
14
|
+
disableTelemetry: true,
|
|
15
|
+
builder: '@storybook/builder-vite',
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
docs: {
|
|
19
|
+
autodocs: false,
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
typescript: {
|
|
23
|
+
// reactDocgen: 'react-docgen-typescript',
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
viteFinal(config) {
|
|
27
|
+
return {
|
|
28
|
+
...config,
|
|
29
|
+
optimizeDeps: {
|
|
30
|
+
exclude: ['storybook-dark-mode'],
|
|
31
|
+
},
|
|
32
|
+
css: {
|
|
33
|
+
postcss: {},
|
|
34
|
+
modules: {
|
|
35
|
+
localsConvention: 'camelCase',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default config
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Preview, StoryContext, StoryFn } from '@storybook/react'
|
|
2
|
+
// biome-ignore lint/correctness/noUnusedImports: <explanation>
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { useState } from 'react'
|
|
5
|
+
import '../stories/assets/sampleStyles.css'
|
|
6
|
+
|
|
7
|
+
const preview: Preview = {
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story: StoryFn, context: StoryContext) => {
|
|
10
|
+
const [value, setValue] = useState(context.args.value || 0)
|
|
11
|
+
return (
|
|
12
|
+
<div>
|
|
13
|
+
<Story
|
|
14
|
+
args={{
|
|
15
|
+
...context.args,
|
|
16
|
+
value,
|
|
17
|
+
onChange: setValue,
|
|
18
|
+
}}
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default preview
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
|
|
3
|
+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
|
4
|
+
|
|
5
|
+
// List of extensions which should be recommended for users of this workspace.
|
|
6
|
+
"recommendations": [
|
|
7
|
+
"christian-kohler.npm-intellisense",
|
|
8
|
+
"christian-kohler.path-intellisense",
|
|
9
|
+
"dbaeumer.vscode-eslint",
|
|
10
|
+
"dsznajder.es7-react-js-snippets",
|
|
11
|
+
"editorconfig.editorconfig",
|
|
12
|
+
"esbenp.prettier-vscode",
|
|
13
|
+
"formulahendry.auto-close-tag",
|
|
14
|
+
"formulahendry.auto-rename-tag",
|
|
15
|
+
"jzarzoso.break-from-comma",
|
|
16
|
+
"lihui.vs-color-picker",
|
|
17
|
+
"meganrogge.template-string-converter",
|
|
18
|
+
"mrmlnc.vscode-json5",
|
|
19
|
+
"msjsdiag.debugger-for-chrome",
|
|
20
|
+
"naumovs.color-highlight",
|
|
21
|
+
"paulmolluzzo.convert-css-in-js",
|
|
22
|
+
"pflannery.vscode-versionlens",
|
|
23
|
+
"quicktype.quicktype",
|
|
24
|
+
"richie5um2.vscode-sort-json",
|
|
25
|
+
"streetsidesoftware.code-spell-checker",
|
|
26
|
+
"unifiedjs.vscode-mdx",
|
|
27
|
+
"wayou.vscode-todo-highlight",
|
|
28
|
+
"zignd.html-css-class-completion"
|
|
29
|
+
],
|
|
30
|
+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
|
31
|
+
"unwantedRecommendations": ["silvenon.mdx"]
|
|
32
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Debugger": {
|
|
3
|
+
"prefix": "db",
|
|
4
|
+
"body": ["debugger // eslint-disable-line"],
|
|
5
|
+
"description": "Break for debugger, but have eslint leave us alone."
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
"Print to console": {
|
|
9
|
+
"prefix": "lg",
|
|
10
|
+
"body": ["console.log($1)", "$2"],
|
|
11
|
+
"description": "Log output to console"
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
"Print debug to console": {
|
|
15
|
+
"prefix": "lgw",
|
|
16
|
+
"body": ["console.log(wrapper.debug())"],
|
|
17
|
+
"description": "Log output to console"
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
"Import act (for enzyme only)": {
|
|
21
|
+
"prefix": "ac",
|
|
22
|
+
"body": ["import { act } from 'react-dom/test-utils'"],
|
|
23
|
+
"description": "Import act() suitable for Enzyme"
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
"Import PropTypes": {
|
|
27
|
+
"prefix": "pt",
|
|
28
|
+
"body": ["import PropTypes from 'prop-types'"],
|
|
29
|
+
"description": "Adds import for PropTypes"
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
"Import classNames": {
|
|
33
|
+
"prefix": "cl",
|
|
34
|
+
"body": ["import cl from 'classnames'"],
|
|
35
|
+
"description": "Adds import for classnames"
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
"Import makeStyles": {
|
|
39
|
+
"prefix": "ms",
|
|
40
|
+
"body": ["import makeStyles from '@material-ui/core/styles/makeStyles'"],
|
|
41
|
+
"description": "Adds import for makeStyles"
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
"Import matchmedia mock": {
|
|
45
|
+
"prefix": "mm",
|
|
46
|
+
"body": [
|
|
47
|
+
"import '@mocks/matchMedia-mock'",
|
|
48
|
+
],
|
|
49
|
+
"description": "Adds import for the matchmedia mock"
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
"Import styled": {
|
|
53
|
+
"prefix": "sty",
|
|
54
|
+
"body": ["import styled from '@material-ui/core/styles/styled'"],
|
|
55
|
+
"description": "Adds import for styled"
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
"Add a useState declaration": {
|
|
59
|
+
"prefix": "ss",
|
|
60
|
+
"body": ["const [${1/(.*)/${1}, set${1:/capitalize}/}] = useState()"],
|
|
61
|
+
"description": "Adds a state hook"
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
"useStyles": {
|
|
65
|
+
"prefix": "us",
|
|
66
|
+
"body": [
|
|
67
|
+
"const useStyles = makeStyles(({ mixins: { rem }, palette }) => ({",
|
|
68
|
+
" root: {",
|
|
69
|
+
" },",
|
|
70
|
+
"}), { name: '${1:$TM_FILENAME_BASE}' })"
|
|
71
|
+
],
|
|
72
|
+
"description": "Adds useStyles"
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
"Insert styles": {
|
|
76
|
+
"prefix": "uss",
|
|
77
|
+
"body": ["const classes = useStyles()"],
|
|
78
|
+
"description": "Get classes from useStyles hook"
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
"use styled": {
|
|
82
|
+
"prefix": "st",
|
|
83
|
+
"body": [
|
|
84
|
+
"export default styled(${1:$TM_FILENAME_BASE})(({ theme: { mixins: {}, palette } }) => ({",
|
|
85
|
+
"}), { name: '${1:$TM_FILENAME_BASE}' })",
|
|
86
|
+
],
|
|
87
|
+
"description": "the styled components form of makeStyles"
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
"React pure function": {
|
|
91
|
+
"prefix": "rcp",
|
|
92
|
+
"body": [
|
|
93
|
+
"import PropTypes from 'prop-types'",
|
|
94
|
+
"",
|
|
95
|
+
"const ${1:$TM_FILENAME_BASE} = (props) => {",
|
|
96
|
+
" const { } = props",
|
|
97
|
+
" return <div>${1:$TM_FILENAME_BASE}</div>",
|
|
98
|
+
"}",
|
|
99
|
+
"",
|
|
100
|
+
"${1:$TM_FILENAME_BASE}.propTypes = {}",
|
|
101
|
+
"",
|
|
102
|
+
"export default ${1:$TM_FILENAME_BASE}",
|
|
103
|
+
"",
|
|
104
|
+
],
|
|
105
|
+
"description": "Shell for a simple react component"
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
"React styled component": {
|
|
109
|
+
"prefix": "rcs",
|
|
110
|
+
"body": [
|
|
111
|
+
"import styled from '@material-ui/core/styles/styled'",
|
|
112
|
+
"",
|
|
113
|
+
"const ${1:$TM_FILENAME_BASE} = ({ className }) => {",
|
|
114
|
+
" return <div className={className}>${1:$TM_FILENAME_BASE}</div>",
|
|
115
|
+
"}",
|
|
116
|
+
"",
|
|
117
|
+
"export default styled(${1:$TM_FILENAME_BASE})(({ theme: { mixins: {}, palette } }) => ({",
|
|
118
|
+
"}), { name: '${1:$TM_FILENAME_BASE}' })",
|
|
119
|
+
"",
|
|
120
|
+
],
|
|
121
|
+
"description": "Shell for a simple styled component"
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
"React pure function useStyles": {
|
|
125
|
+
"prefix": "rcps",
|
|
126
|
+
"body": [
|
|
127
|
+
"import PropTypes from 'prop-types'",
|
|
128
|
+
"import makeStyles from '@material-ui/core/styles/makeStyles'",
|
|
129
|
+
"",
|
|
130
|
+
"const useStyles = makeStyles(({ mixins: {}, palette }) => ({",
|
|
131
|
+
" root: {},",
|
|
132
|
+
"}), { name: '${1:$TM_FILENAME_BASE}' })",
|
|
133
|
+
"",
|
|
134
|
+
"const ${1:$TM_FILENAME_BASE} = (props) => {",
|
|
135
|
+
" const { } = props",
|
|
136
|
+
" const classes = useStyles()",
|
|
137
|
+
"",
|
|
138
|
+
" return <div className={classes.root}>${1:$TM_FILENAME_BASE}</div>",
|
|
139
|
+
"}",
|
|
140
|
+
"",
|
|
141
|
+
"${1:$TM_FILENAME_BASE}.propTypes = {}",
|
|
142
|
+
"",
|
|
143
|
+
"export default ${1:$TM_FILENAME_BASE}",
|
|
144
|
+
"",
|
|
145
|
+
],
|
|
146
|
+
"description": "Shell for simple react component with useStyles"
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
"Empty reducer": {
|
|
150
|
+
"prefix": "red",
|
|
151
|
+
"body": [
|
|
152
|
+
"import PropTypes from 'prop-types'",
|
|
153
|
+
"import { createReducer } from '../utils'",
|
|
154
|
+
"",
|
|
155
|
+
"export const actionTypes = {}",
|
|
156
|
+
"",
|
|
157
|
+
"export const initialState = {}",
|
|
158
|
+
"",
|
|
159
|
+
"export const ${1:name}Shape = PropTypes.shape({})",
|
|
160
|
+
"",
|
|
161
|
+
"export const actions = {}",
|
|
162
|
+
"",
|
|
163
|
+
"export default createReducer(initialState, {})",
|
|
164
|
+
""
|
|
165
|
+
],
|
|
166
|
+
"description": ""
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
"Component test shell": {
|
|
170
|
+
"prefix": "rct",
|
|
171
|
+
"body": [
|
|
172
|
+
"import { compose } from 'redux'",
|
|
173
|
+
"import ${TM_FILENAME_BASE/(?:\\.spec$)/${1}/g} from './${TM_FILENAME_BASE/(?:\\.spec$)/${1}/g}'",
|
|
174
|
+
"",
|
|
175
|
+
"describe('<${TM_FILENAME_BASE/(?:\\.spec$)/${1}/g} />', () => {",
|
|
176
|
+
" const defaultProps = {}",
|
|
177
|
+
"",
|
|
178
|
+
" beforeEach(jest.resetAllMocks)",
|
|
179
|
+
"",
|
|
180
|
+
" const getWrapper = compose(",
|
|
181
|
+
" mount,",
|
|
182
|
+
" createElement(${TM_FILENAME_BASE/(?:\\.spec$)/${1}/g}),",
|
|
183
|
+
" withProps(defaultProps),",
|
|
184
|
+
" )",
|
|
185
|
+
"",
|
|
186
|
+
" it('should render', () => {",
|
|
187
|
+
" const wrapper = getWrapper()",
|
|
188
|
+
" console.log(wrapper.debug())",
|
|
189
|
+
" })",
|
|
190
|
+
"})",
|
|
191
|
+
"",
|
|
192
|
+
],
|
|
193
|
+
"description": "Shell for typical component test"
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
"Component test shell (RTL)": {
|
|
197
|
+
"prefix": "rctl",
|
|
198
|
+
"body": [
|
|
199
|
+
"import '@config/testingLibrary'",
|
|
200
|
+
"import { compose } from 'redux'",
|
|
201
|
+
"import { screen } from '@testing-library/dom'",
|
|
202
|
+
"import { act } from '@testing-library/react'",
|
|
203
|
+
"import userEvent from '@testing-library/user-event'",
|
|
204
|
+
"import ${TM_FILENAME_BASE/(?:\\.spec$)/${1}/g} from './${TM_FILENAME_BASE/(?:\\.spec$)/${1}/g}'",
|
|
205
|
+
"",
|
|
206
|
+
"describe('<${TM_FILENAME_BASE/(?:\\.spec$)/${1}/g} />', () => {",
|
|
207
|
+
" const defaultProps = {}",
|
|
208
|
+
"",
|
|
209
|
+
" beforeEach(jest.resetAllMocks)",
|
|
210
|
+
" afterEach(cleanup)",
|
|
211
|
+
"",
|
|
212
|
+
" const { debug, getByTestId } = screen",
|
|
213
|
+
"",
|
|
214
|
+
" const getWrapper = compose(",
|
|
215
|
+
" render,",
|
|
216
|
+
" createElement(${TM_FILENAME_BASE/(?:\\.spec$)/${1}/g}),",
|
|
217
|
+
" withProps(defaultProps),",
|
|
218
|
+
" )",
|
|
219
|
+
"",
|
|
220
|
+
" it('should render', () => {",
|
|
221
|
+
" getWrapper()",
|
|
222
|
+
" debug()",
|
|
223
|
+
" })",
|
|
224
|
+
"})",
|
|
225
|
+
"",
|
|
226
|
+
],
|
|
227
|
+
"description": "Shell for typical component test, using RTL"
|
|
228
|
+
},
|
|
229
|
+
}
|