-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
45,027 additions
and
434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
dist/ | ||
config/ | ||
coverage/ | ||
node_modules/ | ||
lib/ | ||
es/ | ||
umd/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,87 @@ | ||
{ | ||
"env": { | ||
"jest/globals": true | ||
"parserOptions": { | ||
"ecmaVersion": 2022, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"extends": ["airbnb"], | ||
"extends": [ | ||
"airbnb", | ||
"plugin:react/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:testing-library/react" | ||
], | ||
"globals": { | ||
"page": true, | ||
"document": true | ||
"document": true, | ||
"vi": true | ||
}, | ||
"parser": "babel-eslint", | ||
"plugins": ["jest"], | ||
"plugins": [ | ||
"react", | ||
"react-hooks", | ||
"testing-library" | ||
], | ||
"rules": { | ||
"import/no-unresolved": [ | ||
2, { "ignore": ["test-utils"] } | ||
], | ||
"import/prefer-default-export": "off", | ||
"no-console": "off", | ||
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }], | ||
"no-unused-vars": "off", | ||
"no-undef": "off", | ||
"no-restricted-syntax": ["warn", "WithStatement"], | ||
"no-restricted-globals": ["error"], | ||
"eqeqeq": ["warn", "smart"], | ||
"no-use-before-define": [ | ||
"warn", | ||
{ | ||
"functions": false, | ||
"classes": false, | ||
"variables": false | ||
}, | ||
], | ||
"no-mixed-operators": [ | ||
"warn", | ||
{ | ||
"groups": [ | ||
["&", "|", "^", "~", "<<", ">>", ">>>"], | ||
["==", "!=", "===", "!==", ">", ">=", "<", "<="], | ||
["&&", "||"], | ||
["in", "instanceof"], | ||
], | ||
"allowSamePrecedence": false, | ||
}, | ||
], | ||
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], | ||
"no-underscore-dangle": "off", | ||
"react/prefer-stateless-function": "off", | ||
"react/jsx-props-no-spreading": "off", | ||
"react/function-component-definition": "off", | ||
"default-param-last": "off", | ||
"arrow-parens": "off", | ||
"import/no-anonymous-default-export": "off", | ||
"import/no-extraneous-dependencies": "off", | ||
"max-len": ["error", { | ||
"code": 120, | ||
"ignoreComments": true, | ||
"ignoreStrings": true, | ||
"ignoreTemplateLiterals": true, | ||
"ignoreRegExpLiterals": true | ||
}], | ||
"react/jsx-uses-react": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"react/require-default-props": [2, { | ||
"functions": "defaultArguments" | ||
}], | ||
"react-hooks/exhaustive-deps": "error", | ||
"testing-library/render-result-naming-convention": "off", | ||
"testing-library/no-render-in-lifecycle": [ | ||
"error", | ||
{ | ||
"allowTestingFrameworkSetupHook": "beforeEach" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { render } from '@testing-library/react'; | ||
import PropTypes from 'prop-types'; | ||
import { createStore, applyMiddleware } from 'redux'; | ||
import { thunk } from 'redux-thunk'; | ||
import { createTheme, ThemeProvider, StyledEngineProvider } from '@mui/material/styles'; | ||
import { rootReducer as createRootReducer, settings } from 'mirador'; | ||
|
||
const rootReducer = createRootReducer(); | ||
const theme = createTheme(settings.theme); | ||
|
||
/** | ||
* Hook up our rendered object to redux | ||
*/ | ||
function renderWithProviders( | ||
ui, | ||
{ | ||
preloadedState = {}, | ||
// Automatically create a store instance if no store was passed in | ||
store = createStore(rootReducer, preloadedState, applyMiddleware(thunk)), | ||
...renderOptions | ||
} = {}, | ||
) { | ||
/** :nodoc: */ | ||
function Wrapper({ children }) { | ||
return ( | ||
<StyledEngineProvider injectFirst> | ||
<ThemeProvider theme={theme}> | ||
<Provider store={store}>{children}</Provider> | ||
</ThemeProvider> | ||
</StyledEngineProvider> | ||
); | ||
} | ||
|
||
Wrapper.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
}; | ||
|
||
const rendered = render(ui, { wrapper: Wrapper, ...renderOptions }); | ||
|
||
// Return an object with the store and all of RTL's query functions | ||
return { | ||
store, | ||
...rendered, | ||
rerender: (newUi, options) => render( | ||
newUi, | ||
{ container: rendered.container, wrapper: Wrapper, ...options }, | ||
), | ||
}; | ||
} | ||
|
||
export * from '@testing-library/react'; | ||
export { renderWithProviders as render }; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.