Skip to content

Commit

Permalink
Merge pull request #1 from marmelab/master
Browse files Browse the repository at this point in the history
update to latest
  • Loading branch information
gganebnyi authored Jul 14, 2019
2 parents ab4c825 + d2f1dd4 commit 32fc68e
Show file tree
Hide file tree
Showing 163 changed files with 2,980 additions and 1,411 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
build
lib
esm
22 changes: 22 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"react-app",
"plugin:prettier/recommended",
"prettier/@typescript-eslint",
"prettier/babel",
"prettier/react"
],
"plugins": [
"@typescript-eslint",
"import",
"jsx-a11y",
"prettier",
"react",
"react-hooks"
],
"rules": {
"no-use-before-define": "off",
"prettier/prettier": "error"
}
}
5 changes: 5 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "lint-staged"
}
}
10 changes: 10 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"git add",
],
"*.{json,css,md}": [
"prettier",
"git add"
]
}
15 changes: 15 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
arrowParens: 'avoid',
bracketSpacing: true,
jsxBracketSameLine: false,
jsxSingleQuote: false,
printWidth: 80,
quoteProps: 'as-needed',
rangeStart: 0,
rangeEnd: Infinity,
semi: true,
singleQuote: true,
tabWidth: 4,
trailingComma: 'es5',
useTabs: false
}
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# Changelog

## v2.9.4

* Fix closing delete confirmation modal triggers datagrid rowClick event ([3360](https://github.com/marmelab/react-admin/pull/3360)) ([Kmaschta](https://github.com/Kmaschta))
* Fix `<DashboardMenuItem>` does not use `className` prop ([3357](https://github.com/marmelab/react-admin/pull/3357)) ([Kmaschta](https://github.com/Kmaschta))
* Fix unused import in tutorial ([3366](https://github.com/marmelab/react-admin/pull/3366)) ([jesseshieh](https://github.com/jesseshieh))
* Fix broken links to material-ui v1 documentation ([3365](https://github.com/marmelab/react-admin/pull/3365)) ([fzaninotto](https://github.com/fzaninotto))
* Fix broken link to Bulk Action Buttons in docs ([3361](https://github.com/marmelab/react-admin/pull/3361)) ([bmuthoga](https://github.com/bmuthoga))
* Fix dead link to material-ui doc in List customization ([3353](https://github.com/marmelab/react-admin/pull/3353)) ([Kmaschta](https://github.com/Kmaschta))
* Fix typo in Custom Input documentation ([3346](https://github.com/marmelab/react-admin/pull/3346)) ([CrossEye](https://github.com/CrossEye))

## v2.9.3

* Fix issue with `<TabbedForm>` when used inside a dialog ([3335](https://github.com/marmelab/react-admin/pull/3335)) ([griiettner](https://github.com/griiettner))
* Fix `<AutoCompleteArrayInput>` not showing error message ([3327](https://github.com/marmelab/react-admin/pull/3327)) ([hithacker](https://github.com/hithacker))
* Fix `<ListView>` component isn't exported ([3319](https://github.com/marmelab/react-admin/pull/3319)) ([cherniavskii](https://github.com/cherniavskii))
* Fix `<MenuItemLink>` `primaryText` documentation ([3316](https://github.com/marmelab/react-admin/pull/3316)) ([fzaninotto](https://github.com/fzaninotto))
* Fix typo in `callback` side effect documentation ([3297](https://github.com/marmelab/react-admin/pull/3297)) ([0xflotus](https://github.com/0xflotus))
* Fix `<SelectInput>` is resettable even when it's disabled ([3293](https://github.com/marmelab/react-admin/pull/3293)) ([sagarbakhtar](https://github.com/sagarbakhtar))
* Fix `<CheckboxGroupInput>` `options` documentation ([3292](https://github.com/marmelab/react-admin/pull/3292)) ([sagarbakhtar](https://github.com/sagarbakhtar))
* Fix custom `<LogoutButton>` documentation ([3283](https://github.com/marmelab/react-admin/pull/3283)) ([sagarbakhtar](https://github.com/sagarbakhtar))
* Fix posts list export in demo app ([3279](https://github.com/marmelab/react-admin/pull/3279)) ([fargito](https://github.com/fargito))
* Fix nested property filter is hidden on location change but still applied ([3274](https://github.com/marmelab/react-admin/pull/3274)) ([donatascn](https://github.com/donatascn))
* Fix duplicate API call in `<ReferenceArrayInput>` ([3252](https://github.com/marmelab/react-admin/pull/3252)) ([fargito](https://github.com/fargito))
* Fix `<RichTextInput>` validation bugs ([3223](https://github.com/marmelab/react-admin/pull/3223)) ([cherniavskii](https://github.com/cherniavskii))
* Fix `<AutocompleteInput>` popup re-renders after choice is selected ([3190](https://github.com/marmelab/react-admin/pull/3190)) ([FACOLOMBANI](https://github.com/FACOLOMBANI))
* Replace tslint with eslint (because tslint is deprecated) ([3322](https://github.com/marmelab/react-admin/pull/3322)) ([djhi](https://github.com/djhi))
* Update Prettier ([3304](https://github.com/marmelab/react-admin/pull/3304)) ([djhi](https://github.com/djhi))
* Add `ra-auth-acl` to the ecosystem ([3301](https://github.com/marmelab/react-admin/pull/3301)) ([Kmaschta](https://github.com/Kmaschta))
* Add pre-commit hooks to ensure code style is consistent on commits ([3306](https://github.com/marmelab/react-admin/pull/3306)) ([3334](https://github.com/marmelab/react-admin/pull/3334)) ([djhi](https://github.com/djhi))

## v2.9.2

* Fix spinner position in Login and Save buttons ([3276](https://github.com/marmelab/react-admin/pull/3276)) ([Luwangel](https://github.com/Luwangel))
* Fix slow List view when fetching lots of rows ([3275](https://github.com/marmelab/react-admin/pull/3275)) ([slecoustre](https://github.com/slecoustre))
* Fix `<BooleanInput>` does not show errors ([3271](https://github.com/marmelab/react-admin/pull/3271)) ([fargito](https://github.com/fargito))
* Fix `<Query>` component sending request on every update ([3267](https://github.com/marmelab/react-admin/pull/3267)) ([fargito](https://github.com/fargito))
* Fix duplicated entry in Reference documentation ([3259](https://github.com/marmelab/react-admin/pull/3259)) ([mabhub](https://github.com/mabhub))
* Fix duplicated code formatting rules ([3258](https://github.com/marmelab/react-admin/pull/3258)) ([fargito](https://github.com/fargito))
* Fix empty list after changing the items per page count ([3257](https://github.com/marmelab/react-admin/pull/3257)) ([sagarbakhtar](https://github.com/sagarbakhtar))
* Fix `<RichTextInput>` does not use theme color to show focus ([3231](https://github.com/marmelab/react-admin/pull/3231)) ([cherniavskii](https://github.com/cherniavskii))
* Add Bulgarian translation link ([3260](https://github.com/marmelab/react-admin/pull/3260)) ([ptodorov0](https://github.com/ptodorov0))

## v2.9.1

* Fix handling of deleted references ([3216](https://github.com/marmelab/react-admin/pull/3216)) ([djhi](https://github.com/djhi))
* Fix warning in Login page ([3195](https://github.com/marmelab/react-admin/pull/3195)) ([cherniavskii](https://github.com/cherniavskii))
* Fix improperly named `RejectButton` class name in demo ([3182](https://github.com/marmelab/react-admin/pull/3182)) ([ericwb](https://github.com/ericwb))
* Fix outdated mention in Authentication documentation ([3177](https://github.com/marmelab/react-admin/pull/3177)) ([joehillen](https://github.com/joehillen))
* Add link to NextJs Crud dataprovider ([3201](https://github.com/marmelab/react-admin/pull/3201)) ([gganebnyi](https://github.com/gganebnyi))
* Add markdown input package to the Ecosystem documentation ([3204](https://github.com/marmelab/react-admin/pull/3204)) ([maluramichael](https://github.com/maluramichael))

# v2.9.0

* Add support for styled `<ListView>`, `<EditView>`, `<CreateView>`, and `<ShowView>` components ([3161](https://github.com/marmelab/react-admin/pull/3161)) ([cherniavskii](https://github.com/cherniavskii))
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ serve-github-pages: ## Serve the doc from a Github Pages docker container

lint: ## lint the code and check coding conventions
@echo "Running linter..."
@yarn -s tslint 'packages/*/src/**/*.*s'
@yarn -s lint

prettier: ## prettify the source code using prettier
@echo "Running prettier..."
Expand All @@ -117,7 +117,8 @@ test-unit: ## launch unit tests
fi

test-unit-watch: ## launch unit tests and watch for changes
yarn -s test-unit --watch
echo "Running unit tests..."; \
yarn -s test-unit; \

test-e2e: ## launch end-to-end tests
@if [ "$(build)" != "false" ]; then \
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A frontend Framework for building admin applications running in the browser on t
## Features

* Adapts to any backend (REST, GraphQL, SOAP, etc.)
* Powered by [material-ui](https://material-ui.com/), [redux](https://redux.js.org/), [redux-form](https://redux-form.com/7.3.0/), [redux-saga](https://redux-saga.js.org/), [react-router](https://reacttraining.com/react-router/), [recompose](https://github.com/acdlite/recompose), [reselect](https://github.com/reduxjs/reselect) and a few more
* Powered by [material-ui](https://v1.material-ui.com/), [redux](https://redux.js.org/), [redux-form](https://redux-form.com/7.3.0/), [redux-saga](https://redux-saga.js.org/), [react-router](https://reacttraining.com/react-router/), [recompose](https://github.com/acdlite/recompose), [reselect](https://github.com/reduxjs/reselect) and a few more
* Super-fast UI thanks to optimistic rendering (renders before the server returns)
* Undo updates and deletes for a few seconds
* Complete documentation
Expand Down Expand Up @@ -144,7 +144,7 @@ See the [Data Providers documentation](https://marmelab.com/react-admin/DataProv

## Batteries Included But Removable

React-admin is designed as a library of loosely coupled React components built on top of [material-ui](http://www.material-ui.com/#/), in addition to controller functions implemented the Redux way. It is very easy to replace one part of react-admin with your own, e.g. to use a custom datagrid, GraphQL instead of REST, or bootstrap instead of Material Design.
React-admin is designed as a library of loosely coupled React components built on top of [material-ui](http://v1.material-ui.com/), in addition to controller functions implemented the Redux way. It is very easy to replace one part of react-admin with your own, e.g. to use a custom datagrid, GraphQL instead of REST, or bootstrap instead of Material Design.

## Examples

Expand Down Expand Up @@ -191,7 +191,9 @@ or
yarn test
```

When working on the end to end tests, you can leverage [cypress](https://www.cypress.io/) runner by starting the simple example yourself (`make run-simple`) and starting cypress in another terminal (`make test-e2e-local` or `yarn test-e2e-local`).
Besides, tests related to the modified files are ran automatically at commit.

When working on the end to end tests, you can leverage [cypress](https://www.cypress.io/) runner by starting the simple example yourself (`make run-simple` or `yarn run-simple`) and starting cypress in another terminal (`make test-e2e-local` or `yarn test-e2e-local`).

If you have coding standards problems, you can fix them automatically using `prettier` by calling

Expand All @@ -205,6 +207,8 @@ or
yarn prettier
```

However, these commands are ran automatically at each commit so you shouldn't have to worry about them.

If you want to contribute to the documentation, install [jekyll](https://jekyllrb.com/docs/home/), then call

```sh
Expand Down
9 changes: 9 additions & 0 deletions cypress/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../.eslintrc",
"plugins": [
"cypress"
],
"env": {
"cypress/globals": true
}
}
69 changes: 69 additions & 0 deletions cypress/integration/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ describe('Create Page', () => {
name: 'teaser',
value: 'Test teaser',
},
{
type: 'rich-text-input',
name: 'body',
value: 'Test body',
},
];

CreatePage.setValues(values);
Expand Down Expand Up @@ -103,6 +108,11 @@ describe('Create Page', () => {
name: 'teaser',
value: 'Test teaser',
},
{
type: 'rich-text-input',
name: 'body',
value: 'Test body',
},
];

CreatePage.setValues(values);
Expand All @@ -124,6 +134,11 @@ describe('Create Page', () => {
name: 'teaser',
value: 'Test teaser',
},
{
type: 'rich-text-input',
name: 'body',
value: 'Test body',
},
];
CreatePage.setValues(values);
CreatePage.submitAndAdd();
Expand Down Expand Up @@ -153,6 +168,11 @@ describe('Create Page', () => {
name: 'commentable',
value: false,
},
{
type: 'rich-text-input',
name: 'body',
value: 'Test body',
},
];

CreatePage.setValues(values);
Expand Down Expand Up @@ -212,4 +232,53 @@ describe('Create Page', () => {
expect(el).to.have.value('The real Slim Shady!')
);
});

it('should not show rich text input error message when field is untouched', () => {
cy.get(CreatePage.elements.richTextInputError).should('not.exist');
});

it('should show rich text input error message when form is submitted', () => {
CreatePage.submit();
cy.get(CreatePage.elements.richTextInputError)
.should('exist')
.contains('Required');
});

it('should not show rich text input error message when form is submitted and input is filled with text', () => {
CreatePage.submit();
cy.get(CreatePage.elements.richTextInputError)
.should('exist')
.contains('Required');
cy.get(CreatePage.elements.input('body', 'rich-text-input')).type(
'text'
);
cy.get(CreatePage.elements.richTextInputError).should('not.exist');
});

it('should show body in edit view after creating new post', () => {
const values = [
{
type: 'input',
name: 'title',
value: 'Test title',
},
{
type: 'textarea',
name: 'teaser',
value: 'Test teaser',
},
{
type: 'rich-text-input',
name: 'body',
value: 'Test body',
},
];

CreatePage.setValues(values);
CreatePage.submit();
EditPage.gotoTab(2);
cy.get(EditPage.elements.input('body', 'rich-text-input')).contains(
'Test body'
);
});
});
28 changes: 17 additions & 11 deletions cypress/integration/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Edit Page', () => {
});

it('should allow to update elements', () => {
EditPostPage.setInputValue('title', 'Lorem Ipsum');
EditPostPage.setInputValue('input', 'title', 'Lorem Ipsum');
EditPostPage.submit();
EditPostPage.navigate();
cy.get(EditPostPage.elements.input('title')).should(el =>
Expand All @@ -34,7 +34,7 @@ describe('Edit Page', () => {
});

it('should redirect to list page after edit success', () => {
EditPostPage.setInputValue('title', 'Lorem Ipsum +');
EditPostPage.setInputValue('input', 'title', 'Lorem Ipsum +');
EditPostPage.submit();
cy.url().then(url => expect(url).to.contain('/#/posts'));
});
Expand Down Expand Up @@ -68,21 +68,26 @@ describe('Edit Page', () => {
);

// This validate that the current redux form values are not kept after we navigate
EditCommentPage.setInputValue('body', 'Test');
EditCommentPage.setInputValue('input', 'body', 'Test');

CreatePostPage.navigate();

cy.get(CreatePostPage.elements.bodyInput).should(el =>
// When the Quill editor is empty, it add the "ql-blank" CSS class
expect(el).to.have.class('ql-blank')
cy.get(CreatePostPage.elements.input('body', 'rich-text-input')).should(
el =>
// When the Quill editor is empty, it add the "ql-blank" CSS class
expect(el).to.have.class('ql-blank')
);
});

it('should allow to select an item from the AutocompleteInput without showing the choices again after', () => {
EditCommentPage.navigate();
cy.get(EditCommentPage.elements.input('post_id')).clear().type('Sed quo');
cy.get(EditCommentPage.elements.input('post_id'))
.clear()
.type('Sed quo');
cy.get('[role="tooltip"]').within(() => {
cy.contains('Accusantium qui nihil voluptatum quia voluptas maxime ab similique');
cy.contains(
'Accusantium qui nihil voluptatum quia voluptas maxime ab similique'
);
cy.contains('Sed quo et et fugiat modi').click();
});
cy.get('[role="tooltip"]').should(el => expect(el).to.not.exist);
Expand All @@ -92,13 +97,14 @@ describe('Edit Page', () => {
cy.get('[role="tooltip"]').should(el => expect(el).to.not.exist);

// Ensure they still appear when needed though
cy.get(EditCommentPage.elements.input('post_id')).clear().type('architecto aut');
cy.get(EditCommentPage.elements.input('post_id'))
.clear()
.type('architecto aut');
cy.get('[role="tooltip"]').within(() => {
cy.contains('Sed quo et et fugiat modi');
cy.contains('Sint dignissimos in architecto aut');
cy.contains('A voluptas eius eveniet ut commodi dolor');
});

});

it('should reset the form correctly when switching from edit to create', () => {
Expand All @@ -108,7 +114,7 @@ describe('Edit Page', () => {
);

// This validate that the current redux form values are not kept after we navigate
EditPostPage.setInputValue('title', 'Another title');
EditPostPage.setInputValue('input', 'title', 'Another title');

CreatePostPage.navigate();
cy.get(CreatePostPage.elements.input('title')).should(el =>
Expand Down
Loading

0 comments on commit 32fc68e

Please sign in to comment.