Skip to content

Commit

Permalink
Init attributes list
Browse files Browse the repository at this point in the history
  • Loading branch information
soupette committed Mar 7, 2019
1 parent 2223330 commit 533c8fe
Show file tree
Hide file tree
Showing 21 changed files with 322 additions and 47 deletions.
2 changes: 1 addition & 1 deletion jest.config.front.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
// NOTE: Should be dynamic
moduleDirectories: [
'node_modules',
'<rootDir>/packages/strapi-admin/admin/src',
// '<rootDir>/packages/strapi-admin/admin/src',
'<rootDir>/packages/strapi-helper-plugin/node_modules',
'<rootDir>/packages/strapi-helper-plugin',
'<rootDir>/packages/strapi-helper-plugin/lib/src',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
*/

import React from 'react';

{{#if wantMessages}}
import { FormattedMessage } from 'react-intl';
import messages from './messages';
{{/if}}

import PropTypes from 'prop-types';
{{#if wantCSS}}
import styles from './styles.scss';
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// import {{ properCase name }} from '../index';
import React from 'react';
import { shallow } from 'enzyme';

import expect from 'expect';
// import { shallow } from 'enzyme';
// import React from 'react';
import {{ properCase name }} from '../index';

describe('<{{ properCase name }} />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(false);
it('should not crash', () => {
shallow(<{{ properCase name }} />);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@

import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';

import styles from './styles.scss';

const LoadingIndicatorPage = (props) => {
if (props.error) {
return <div>An error occurred</div>;
return (
<div style={{ padding: 40 }}>
<h2><FormattedMessage id="components.ErrorBoundary.title" /></h2>
<p>{props.error && props.error.toString()}</p>
<br />
<details style={{ whiteSpace: 'pre-wrap' }}>
{props.error.stack}
</details>
</div>
);
}

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
*
* Block
*
*/

import React from 'react';
import PropTypes from 'prop-types';
import styles from './styles.scss';

function Block({ children }) {
return (
<div className={styles.block}>
{children}
</div>
);
}

Block.defaultProps = {
children: null,
};

Block.propTypes = {
children: PropTypes.node,
};

export default Block;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.block {
padding: 1.8rem 0 0 0;
border-radius: 0.2rem;
background-color: #FFFFFF;
box-shadow: 0 0.2rem 0.4rem 0 #E3E9F3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { shallow } from 'enzyme';

import Block from '../index';

describe('<Block />', () => {
it('should not crash', () => {
shallow(<Block />);
});

it('should render his children', () => {
const Child = () => <div>I'm a child</div>;
const wrapper = shallow(<Block><Child /></Block>);

expect(wrapper.find(Child).exists()).toBe(true);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
*
* Flex
*
*/

import React from 'react';
import PropTypes from 'prop-types';
import styles from './styles.scss';

function Flex({ children }) {
return (
<div className={styles.flex}>
{children}
</div>
);
}

Flex.defaultProps = {
children: null,
};

Flex.propTypes = {
children: PropTypes.node,
};

export default Flex;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.flex {
display: flex;
justify-content: space-between;
padding: 0 1rem 0 2.8rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { shallow } from 'enzyme';

import Flex from '../index';

describe('<Flex />', () => {
it('should not crash', () => {
shallow(<Flex />);
});

it('should render his children', () => {
const Child = () => <div>I'm a child</div>;
const wrapper = shallow(<Flex><Child /></Flex>);

expect(wrapper.find(Child).exists()).toBe(true);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
*
* ListTitle
*
*/

import React from 'react';
import PropTypes from 'prop-types';

import styles from './styles.scss';

function ListTitle({ children }) {
return (
<div className={styles.listTitle}>
{children}
</div>
);
}

ListTitle.defaultProps = {
children: null,
};

ListTitle.propTypes = {
children: PropTypes.node,
};

export default ListTitle;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.listTitle {
color: #333740;
font-family: Lato;
font-size: 1.8rem;
font-weight: bold;
line-height: 2.2rem;
align-items: flex-start;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { shallow } from 'enzyme';

import ListTitle from '../index';

describe('<ListTitle />', () => {
it('should not crash', () => {
shallow(<ListTitle />);
});

it('should render his children', () => {
const Child = () => <div>I'm a child</div>;
const wrapper = shallow(<ListTitle><Child /></ListTitle>);

expect(wrapper.find(Child).exists()).toBe(true);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
*
* Ul
*
*/

import React from 'react';
import PropTypes from 'prop-types';
import styles from './styles.scss';

function Ul({ children, id }) {
return (
<div className={styles.ul} id={id}>
{children}
</div>
);
}

Ul.defaultProps = {
children: null,
id: null,
};

Ul.propTypes = {
children: PropTypes.node,
id: PropTypes.string,
};

export default Ul;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.ul {
margin-top: 1.5rem;
padding: 0;
list-style: none;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { shallow } from 'enzyme';

import Ul from '../index';

describe('<Ul />', () => {
it('should not crash', () => {
shallow(<Ul />);
});

it('should render its children', () => {
const Child = () => <div>I'm a child</div>;
const wrapper = shallow(<Ul><Child /></Ul>);

expect(wrapper.find(Child).exists()).toBe(true);
});

it('should adopt an id', () => {
const wrapper = shallow(<Ul id="test" />);

expect(wrapper.prop('id')).toBe('test');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import { connect } from 'react-redux';
import { bindActionCreators, compose } from 'redux';
import { Switch, Route } from 'react-router-dom';

import Loader from './Loader';
import pluginId from '../../pluginId';

import HomePage from '../HomePage';
// import HomePage from '../HomePage';
import ModelPage from '../ModelPage';
import NotFoundPage from '../NotFoundPage';

import Loader from './Loader';

import { getData, deleteModel } from './actions';

import reducer from './reducer';
Expand All @@ -26,10 +27,10 @@ import makeSelectApp from './selectors';
import styles from './styles.scss';

const ROUTES = [
{
component: HomePage,
to: `/plugins/${pluginId}`,
},
// {
// component: HomePage,
// to: `/plugins/${pluginId}`,
// },
{
component: ModelPage,
to: `/plugins/${pluginId}/models/:modelName`,
Expand Down Expand Up @@ -76,6 +77,7 @@ export class App extends React.Component { // eslint-disable-line react/prefer-s
App.propTypes = {
deleteModel: PropTypes.func.isRequired,
getData: PropTypes.func.isRequired,
isLoading: PropTypes.bool.isRequired,
};

const mapStateToProps = makeSelectApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

/* eslint-disable redux-saga/yield-effects */
import { all, fork, takeLatest, put } from 'redux-saga/effects';
import defaultSaga, { getData } from '../saga';
import defaultSaga, { deleteModel, getData } from '../saga';

import { getDataSucceeded } from '../actions';
import { GET_DATA } from '../constants';
import { DELETE_MODEL, GET_DATA } from '../constants';

const response = {
models: [
Expand Down Expand Up @@ -68,6 +68,7 @@ describe('defaultSaga Saga', () => {
.toEqual(
all([
fork(takeLatest, GET_DATA, getData),
fork(takeLatest, DELETE_MODEL, deleteModel),
]));
});
});
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// import React from 'react';
import { shallow } from 'enzyme';
// import { shallow } from 'enzyme';

import { HomePage } from '../index';
// import { HomePage } from '../index';

describe('<HomePage />', () => {

let props;
// let props;

beforeEach(() => {
props = {
models: [],
};
// props = {
// models: [],
// };
});

it('should not crash', () => {
shallow(<HomePage {...props} />);
// shallow(<HomePage {...props} />);
});
});
Loading

0 comments on commit 533c8fe

Please sign in to comment.