Skip to content

Commit 010062b

Browse files
authored
Merge pull request #69 from UgnisSoftware/UGN-265
Feature UGN-265 improve validation tests
2 parents b1721b8 + 5fc6b47 commit 010062b

File tree

7 files changed

+718
-49
lines changed

7 files changed

+718
-49
lines changed
Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
1-
const path = require("path")
2-
3-
const toPath = (_path) => path.join(process.cwd(), _path)
4-
5-
module.exports = {
6-
stories: ["../src/**/stories/*.stories.tsx"],
7-
babel: async (options) => ({
8-
...options,
9-
}),
10-
webpackFinal: async (config) => {
11-
config.module.rules.push({
12-
test: /\.mjs$/,
13-
include: /node_modules/,
14-
type: "javascript/auto",
15-
})
16-
return {
17-
...config,
18-
devtool: "inline-source-map",
19-
resolve: {
20-
...config.resolve,
21-
alias: {
22-
...config.resolve.alias,
23-
"@emotion/core": toPath("node_modules/@emotion/react"),
24-
"emotion-theming": toPath("node_modules/@emotion/react"),
25-
},
26-
},
27-
}
28-
},
29-
staticDirs: ["../src/stories/static"],
30-
}
1+
const path = require("path")
2+
3+
const toPath = (_path: string) => path.join(process.cwd(), _path)
4+
5+
module.exports = {
6+
stories: ["../src/**/stories/*.stories.tsx"],
7+
webpackFinal: async (config: any) => {
8+
config.module.rules.push({
9+
test: /\.mjs$/,
10+
include: /node_modules/,
11+
type: "javascript/auto",
12+
})
13+
return {
14+
...config,
15+
devtool: "inline-source-map",
16+
resolve: {
17+
...config.resolve,
18+
alias: {
19+
...config.resolve.alias,
20+
"@emotion/core": toPath("node_modules/@emotion/react"),
21+
"emotion-theming": toPath("node_modules/@emotion/react"),
22+
},
23+
},
24+
}
25+
},
26+
staticDirs: ["../src/stories/static"],
27+
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@
105105
"transformIgnorePatterns": [
106106
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
107107
],
108+
"setupFiles": [
109+
"./src/tests/setup.ts"
110+
],
108111
"setupFilesAfterEnv": [
109112
"@testing-library/jest-dom/extend-expect"
110113
],

src/steps/ValidationStep/ValidationStep.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export const ValidationStep = <T extends string>({ initialData }: Props<T>) => {
101101
<Button variant="outline" size="sm" onClick={deleteSelectedRows}>
102102
{translations.validationStep.discardButtonTitle}
103103
</Button>
104-
<Switch isChecked={filterByErrors} onChange={() => setFilterByErrors(!filterByErrors)}>
104+
<Switch display="flex" isChecked={filterByErrors} onChange={() => setFilterByErrors(!filterByErrors)}>
105105
{translations.validationStep.filterSwitchTitle}
106106
</Switch>
107107
</Box>

src/steps/ValidationStep/components/columns.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import { TableSelect } from "../../../components/Selects/TableSelect"
88

99
const SELECT_COLUMN_KEY = "select-row"
1010

11+
function autoFocusAndSelect(input: HTMLInputElement | null) {
12+
input?.focus()
13+
input?.select()
14+
}
15+
1116
export const generateColumns = <T extends string>(fields: Fields<T>): Column<Data<T> & Meta>[] => [
1217
{
1318
key: SELECT_COLUMN_KEY,
@@ -74,6 +79,7 @@ export const generateColumns = <T extends string>(fields: Fields<T>): Column<Dat
7479
component = (
7580
<Box pl="0.5rem">
7681
<Input
82+
ref={autoFocusAndSelect}
7783
variant="unstyled"
7884
autoFocus
7985
size="small"

0 commit comments

Comments
 (0)