Skip to content

Commit 585d16e

Browse files
committed
fix actions and reducers doc
2 parents 982e7c9 + 13438b1 commit 585d16e

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

docs/developer-guide/writing-actions-reducers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ for example `'/js/actions'` for custom/standard project or `'../web/client/actio
158158
`npm run continuoustest`
159159

160160
This allows to run only the tests contained to the specified path.
161-
**Note:** When all tests are successfully passing remember to restore it to its orignal value '../web'
161+
**Note:** When all tests are successfully passing remember to restore it to its original value.
162162

163163
## How to test a reducer
164164
Here things can become more complicated depending on your reducer but in general you want to test all cases
@@ -179,7 +179,7 @@ describe('Test correctness of the map reducers', () => {
179179
```
180180

181181
Here for speedup testing you can again modify the tests.webpack.js (custom/standard project) or build\tests.webpack.js (framework)
182-
in order to point to the reducers folder and then runnning
182+
in order to point to the reducers folder and then running
183183
`npm run continuoustest`
184184

185185
## Actions and epics

web/client/components/manager/users/UserCard.jsx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const GridCard = require('../../misc/GridCard');
1313
const {Button, Glyphicon} = require('react-bootstrap');
1414
const Message = require('../../../components/I18N/Message');
1515

16-
1716
// const ConfirmModal = require('./modals/ConfirmModal');
1817

1918
require('./style/usercard.css');
@@ -24,6 +23,8 @@ class UserCard extends React.Component {
2423
style: PropTypes.object,
2524
user: PropTypes.object,
2625
innerItemStyle: PropTypes.object,
26+
avatarStyle: PropTypes.object,
27+
nameStyle: PropTypes.object,
2728
actions: PropTypes.array
2829
};
2930

@@ -34,8 +35,24 @@ class UserCard extends React.Component {
3435
backgroundPosition: "center",
3536
backgroundRepeat: "repeat-x"
3637
},
37-
innerItemStyle: {"float": "left",
38+
innerItemStyle: {
39+
position: "relative",
40+
marginTop: "35px",
41+
marginLeft: "10px",
42+
marginRight: "10px",
43+
maxHeight: "85px"
44+
},
45+
avatarStyle: {
3846
margin: "10px"
47+
},
48+
nameStyle: {
49+
position: "absolute",
50+
left: "80px",
51+
top: "30px",
52+
width: "75%",
53+
borderBottom: "1px solid #ddd",
54+
fontSize: 18,
55+
fontWeight: "bold"
3956
}
4057
};
4158

@@ -65,25 +82,29 @@ class UserCard extends React.Component {
6582
};
6683

6784
renderAvatar = () => {
68-
return (<div key="avatar" className="avatar-containter" style={this.props.innerItemStyle} ><Button bsStyle="primary" type="button" className="square-button">
85+
return (<div key="avatar" className="avatar-containter" style={this.props.avatarStyle} ><Button bsStyle="primary" type="button" className="square-button">
6986
<Glyphicon glyph="user" />
7087
</Button></div>);
7188
};
7289

90+
renderName = () => {
91+
return (<div key="name" style={this.props.nameStyle}>{this.props.user.name}</div>);
92+
};
93+
7394
render() {
7495
return (
7596
<GridCard className="user-thumb" style={this.props.style} header={this.props.user.name}
7697
actions={this.props.actions}
7798
>
7899
<div className="user-data-container">
79100
{this.renderAvatar()}
101+
{this.renderName()}
80102
{this.renderRole()}
81103
{this.renderGroups()}
82104
</div>
83-
{this.renderStatus()}
105+
{this.renderStatus()}
84106
</GridCard>
85107
);
86108
}
87109
}
88-
89110
module.exports = UserCard;

web/client/components/manager/users/__tests__/UserCard-test.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ describe("Test UserCard Component", () => {
6868
<UserCard user={{...enabledUser, groups: [undefined]}} />, document.getElementById("container"));
6969
expect(comp).toExist();
7070
expect(document.querySelector('#container .gridcard')).toExist();
71-
71+
});
72+
it('Test username rendering inside the card', () => {
73+
let comp = ReactDOM.render(
74+
<UserCard user={enabledUser} />, document.getElementById("container"));
75+
expect(comp).toExist();
76+
let items = document.querySelectorAll('#container .gridcard .user-data-container > div');
77+
let renderName = items[1];
78+
expect(renderName.innerHTML).toBe(enabledUser.name);
7279
});
7380
});

0 commit comments

Comments
 (0)