Commit e3fc61b3 by Hugo Häggmark Committed by Leonard Gram

refactor: moved test from TeamMembers to TeamMemberRow

parent 178d637b
...@@ -27,6 +27,14 @@ const setup = (propOverrides?: object) => { ...@@ -27,6 +27,14 @@ const setup = (propOverrides?: object) => {
}; };
describe('Render', () => { describe('Render', () => {
it('should render team members when sync enabled', () => {
const member = getMockTeamMember();
member.labels = ['LDAP'];
const { wrapper } = setup({ member, syncEnabled: true });
expect(wrapper).toMatchSnapshot();
});
describe('when feature toggle editorsCanAdmin is turned on', () => { describe('when feature toggle editorsCanAdmin is turned on', () => {
it('should render permissions select if user is team admin', () => { it('should render permissions select if user is team admin', () => {
const { wrapper } = setup({ editorsCanAdmin: true, signedInUserIsTeamAdmin: true }); const { wrapper } = setup({ editorsCanAdmin: true, signedInUserIsTeamAdmin: true });
......
...@@ -46,12 +46,6 @@ describe('Render', () => { ...@@ -46,12 +46,6 @@ describe('Render', () => {
expect(wrapper).toMatchSnapshot(); expect(wrapper).toMatchSnapshot();
}); });
it('should render team members when sync enabled', () => {
const { wrapper } = setup({ members: getMockTeamMembers(5, 5), syncEnabled: true });
expect(wrapper).toMatchSnapshot();
});
}); });
describe('Functions', () => { describe('Functions', () => {
......
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Render should render team members when sync enabled 1`] = `
<tr
key="1"
>
<td
className="width-4 text-center"
>
<img
className="filter-table__avatar"
src="some/url/"
/>
</td>
<td>
testUser
</td>
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
>
<span>
Member
</span>
</div>
</td>
</Component>
<td>
<TagBadge
count={0}
key="LDAP"
label="LDAP"
onClick={[Function]}
removeIcon={false}
/>
</td>
<td
className="text-right"
>
<DeleteButton
disabled={true}
onConfirm={[Function]}
/>
</td>
</tr>
`;
exports[`Render when feature toggle editorsCanAdmin is turned off should not render permissions 1`] = ` exports[`Render when feature toggle editorsCanAdmin is turned off should not render permissions 1`] = `
<tr <tr
key="1" key="1"
......
...@@ -177,7 +177,7 @@ exports[`Render should render team members 1`] = ` ...@@ -177,7 +177,7 @@ exports[`Render should render team members 1`] = `
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<TeamMemberRow <Connect(TeamMemberRow)
editorsCanAdmin={false} editorsCanAdmin={false}
key="1" key="1"
member={ member={
...@@ -197,7 +197,7 @@ exports[`Render should render team members 1`] = ` ...@@ -197,7 +197,7 @@ exports[`Render should render team members 1`] = `
signedInUserIsTeamAdmin={true} signedInUserIsTeamAdmin={true}
syncEnabled={false} syncEnabled={false}
/> />
<TeamMemberRow <Connect(TeamMemberRow)
editorsCanAdmin={false} editorsCanAdmin={false}
key="2" key="2"
member={ member={
...@@ -217,7 +217,7 @@ exports[`Render should render team members 1`] = ` ...@@ -217,7 +217,7 @@ exports[`Render should render team members 1`] = `
signedInUserIsTeamAdmin={true} signedInUserIsTeamAdmin={true}
syncEnabled={false} syncEnabled={false}
/> />
<TeamMemberRow <Connect(TeamMemberRow)
editorsCanAdmin={false} editorsCanAdmin={false}
key="3" key="3"
member={ member={
...@@ -237,7 +237,7 @@ exports[`Render should render team members 1`] = ` ...@@ -237,7 +237,7 @@ exports[`Render should render team members 1`] = `
signedInUserIsTeamAdmin={true} signedInUserIsTeamAdmin={true}
syncEnabled={false} syncEnabled={false}
/> />
<TeamMemberRow <Connect(TeamMemberRow)
editorsCanAdmin={false} editorsCanAdmin={false}
key="4" key="4"
member={ member={
...@@ -257,7 +257,7 @@ exports[`Render should render team members 1`] = ` ...@@ -257,7 +257,7 @@ exports[`Render should render team members 1`] = `
signedInUserIsTeamAdmin={true} signedInUserIsTeamAdmin={true}
syncEnabled={false} syncEnabled={false}
/> />
<TeamMemberRow <Connect(TeamMemberRow)
editorsCanAdmin={false} editorsCanAdmin={false}
key="5" key="5"
member={ member={
...@@ -282,196 +282,3 @@ exports[`Render should render team members 1`] = ` ...@@ -282,196 +282,3 @@ exports[`Render should render team members 1`] = `
</div> </div>
</div> </div>
`; `;
exports[`Render should render team members when sync enabled 1`] = `
<div>
<div
className="page-action-bar"
>
<div
className="gf-form gf-form--grow"
>
<ForwardRef
inputClassName="gf-form-input"
labelClassName="gf-form--has-input-icon gf-form--grow"
onChange={[Function]}
placeholder="Search members"
value=""
/>
</div>
<div
className="page-action-bar__spacer"
/>
<button
className="btn btn-primary pull-right"
disabled={false}
onClick={[Function]}
>
Add member
</button>
</div>
<Component
in={false}
>
<div
className="cta-form"
>
<button
className="cta-form__close btn btn-transparent"
onClick={[Function]}
>
<i
className="fa fa-close"
/>
</button>
<h5>
Add team member
</h5>
<div
className="gf-form-inline"
>
<UserPicker
className="min-width-30"
onSelected={[Function]}
/>
</div>
</div>
</Component>
<div
className="admin-list-table"
>
<table
className="filter-table filter-table--hover form-inline"
>
<thead>
<tr>
<th />
<th>
Name
</th>
<th>
Email
</th>
<Component
featureToggle={false}
>
<th>
Permission
</th>
</Component>
<th />
<th
style={
Object {
"width": "1%",
}
}
/>
</tr>
</thead>
<tbody>
<TeamMemberRow
editorsCanAdmin={false}
key="1"
member={
Object {
"avatarUrl": "some/url/",
"email": "test@test.com",
"labels": Array [
"label 1",
"label 2",
],
"login": "testUser-1",
"permission": 0,
"teamId": 1,
"userId": 1,
}
}
signedInUserIsTeamAdmin={true}
syncEnabled={true}
/>
<TeamMemberRow
editorsCanAdmin={false}
key="2"
member={
Object {
"avatarUrl": "some/url/",
"email": "test@test.com",
"labels": Array [
"label 1",
"label 2",
],
"login": "testUser-2",
"permission": 0,
"teamId": 1,
"userId": 2,
}
}
signedInUserIsTeamAdmin={true}
syncEnabled={true}
/>
<TeamMemberRow
editorsCanAdmin={false}
key="3"
member={
Object {
"avatarUrl": "some/url/",
"email": "test@test.com",
"labels": Array [
"label 1",
"label 2",
],
"login": "testUser-3",
"permission": 0,
"teamId": 1,
"userId": 3,
}
}
signedInUserIsTeamAdmin={true}
syncEnabled={true}
/>
<TeamMemberRow
editorsCanAdmin={false}
key="4"
member={
Object {
"avatarUrl": "some/url/",
"email": "test@test.com",
"labels": Array [
"label 1",
"label 2",
],
"login": "testUser-4",
"permission": 0,
"teamId": 1,
"userId": 4,
}
}
signedInUserIsTeamAdmin={true}
syncEnabled={true}
/>
<TeamMemberRow
editorsCanAdmin={false}
key="5"
member={
Object {
"avatarUrl": "some/url/",
"email": "test@test.com",
"labels": Array [
"label 1",
"label 2",
],
"login": "testUser-5",
"permission": 4,
"teamId": 1,
"userId": 5,
}
}
signedInUserIsTeamAdmin={true}
syncEnabled={true}
/>
</tbody>
</table>
</div>
</div>
`;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment