fix lint errors

This commit is contained in:
Vyrtsev Mikhail
2019-07-15 17:57:43 -05:00
committed by Umputun
parent 9e726d5769
commit 8cd5533aed
5 changed files with 33 additions and 31 deletions
@@ -24,7 +24,7 @@ describe('<AuthPanel />', () => {
});
it('should render login form with google and github provider', () => {
const element = <AuthPanel {...DefaultProps as Props} user={null} />;
const element = <AuthPanel {...(DefaultProps as Props)} user={null} />;
render(element, container);
@@ -45,7 +45,7 @@ describe('<AuthPanel />', () => {
it('should render login form with google and github provider for read-only post', () => {
const element = (
<AuthPanel
{...DefaultProps as Props}
{...(DefaultProps as Props)}
user={null}
postInfo={{ ...DefaultProps.postInfo, read_only: true } as PostInfo}
/>
@@ -70,7 +70,7 @@ describe('<AuthPanel />', () => {
it('should not render settings if there is no hidden users', () => {
const element = (
<AuthPanel
{...DefaultProps as Props}
{...(DefaultProps as Props)}
user={null}
postInfo={{ ...DefaultProps.postInfo, read_only: true } as PostInfo}
/>
@@ -86,7 +86,7 @@ describe('<AuthPanel />', () => {
it('should render settings if there is some hidden users', () => {
const element = (
<AuthPanel
{...DefaultProps as Props}
{...(DefaultProps as Props)}
user={null}
postInfo={{ ...DefaultProps.postInfo, read_only: true } as PostInfo}
hiddenUsers={{ hidden_joe: {} as any }}
@@ -108,7 +108,7 @@ describe('<AuthPanel />', () => {
});
it('should render info about current user', () => {
const element = <AuthPanel {...DefaultProps as Props} user={{ id: `john`, name: 'John' } as User} />;
const element = <AuthPanel {...(DefaultProps as Props)} user={{ id: `john`, name: 'John' } as User} />;
render(element, container);
@@ -129,7 +129,9 @@ describe('<AuthPanel />', () => {
});
it('should render admin action', () => {
const element = <AuthPanel {...DefaultProps as Props} user={{ id: `test`, admin: true, name: 'John' } as User} />;
const element = (
<AuthPanel {...(DefaultProps as Props)} user={{ id: `test`, admin: true, name: 'John' } as User} />
);
render(element, container);
@@ -2,7 +2,8 @@
transform: scale(1, -1);
margin-left: 4px;
&.comment__vote_selected, &:hover {
&.comment__vote_selected,
&:hover {
background-image: url('comment__vote_type_down.svg');
}
}
@@ -1,7 +1,8 @@
.comment__vote_type_up {
margin-right: 4px;
&.comment__vote_selected, &:hover {
&.comment__vote_selected,
&:hover {
background-image: url('comment__vote_type_up.svg');
}
}
@@ -37,7 +37,7 @@ describe('<Comment />', () => {
});
it('disabled on user info widget', () => {
const element = <Comment {...{ ...DefaultProps, view: 'user' } as Props} />;
const element = <Comment {...({ ...DefaultProps, view: 'user' } as Props)} />;
render(element, container);
const voteButtons = container.querySelectorAll('.comment__vote');
@@ -51,7 +51,7 @@ describe('<Comment />', () => {
it('disabled on read only post', () => {
const element = (
<Comment {...{ ...DefaultProps, post_info: { ...DefaultProps.post_info, read_only: true } } as Props} />
<Comment {...({ ...DefaultProps, post_info: { ...DefaultProps.post_info, read_only: true } } as Props)} />
);
render(element, container);
@@ -67,7 +67,7 @@ describe('<Comment />', () => {
it('disabled for deleted comment', () => {
const element = (
// ahem
<Comment {...{ ...DefaultProps, data: { ...DefaultProps.data, delete: true } } as Props} />
<Comment {...({ ...DefaultProps, data: { ...DefaultProps.data, delete: true } } as Props)} />
);
render(element, container);
@@ -83,13 +83,13 @@ describe('<Comment />', () => {
it('disabled for guest', () => {
const element = (
<Comment
{...{
{...({
...DefaultProps,
user: {
id: 'someone',
picture: 'somepicture-url',
},
} as Props}
} as Props)}
/>
);
render(element, container);
@@ -104,7 +104,7 @@ describe('<Comment />', () => {
});
it('disabled for own comment', () => {
const element = <Comment {...{ ...DefaultProps, user: null } as Props} />;
const element = <Comment {...({ ...DefaultProps, user: null } as Props)} />;
render(element, container);
const voteButtons = container.querySelectorAll('.comment__vote');
@@ -120,7 +120,7 @@ describe('<Comment />', () => {
const voteSpy = jest.fn(async () => {});
const element = (
<Comment
{...DefaultProps as Props}
{...(DefaultProps as Props)}
data={{ ...DefaultProps.data, vote: +1 } as Props['data']}
putCommentVote={voteSpy}
/>
@@ -145,7 +145,7 @@ describe('<Comment />', () => {
const voteSpy = jest.fn(async () => {});
const element = (
<Comment
{...DefaultProps as Props}
{...(DefaultProps as Props)}
data={{ ...DefaultProps.data, vote: -1 } as Props['data']}
putCommentVote={voteSpy}
/>
@@ -175,7 +175,7 @@ describe('<Comment />', () => {
});
it('for admin if shows admin controls', () => {
const element = <Comment {...{ ...DefaultProps, user: { ...DefaultProps.user, admin: true } } as Props} />;
const element = <Comment {...({ ...DefaultProps, user: { ...DefaultProps.user, admin: true } } as Props)} />;
render(element, container);
const controls = container.querySelectorAll('.comment__controls > span');
@@ -188,7 +188,7 @@ describe('<Comment />', () => {
});
it('for regular user it shows only "hide"', () => {
const element = <Comment {...{ ...DefaultProps, user: { ...DefaultProps.user, admin: false } } as Props} />;
const element = <Comment {...({ ...DefaultProps, user: { ...DefaultProps.user, admin: false } } as Props)} />;
render(element, container);
const controls = container.querySelectorAll('.comment__controls > span');
@@ -197,7 +197,7 @@ describe('<Comment />', () => {
});
it('verification badge clickable for admin', () => {
const element = <Comment {...{ ...DefaultProps, user: { ...DefaultProps.user, admin: true } } as Props} />;
const element = <Comment {...({ ...DefaultProps, user: { ...DefaultProps.user, admin: true } } as Props)} />;
render(element, container);
const controls = container.querySelector('.comment__verification')!;
@@ -207,10 +207,10 @@ describe('<Comment />', () => {
it('verification badge not clickable for regular user', () => {
const element = (
<Comment
{...{
{...({
...DefaultProps,
data: { ...DefaultProps.data, user: { ...DefaultProps.data!.user, verified: true } },
} as Props}
} as Props)}
/>
);
render(element, container);
+8 -10
View File
@@ -4,17 +4,15 @@ export function parseQuery(search: string): { [key: string]: string } {
return search
.substr(1)
.split('&')
.map(
(chunk): [string, string] => {
const parts = chunk.split('=');
if (parts.length < 2) {
parts[1] = '';
} else {
parts[1] = decodeURIComponent(parts[1]);
}
return parts as [string, string];
.map((chunk): [string, string] => {
const parts = chunk.split('=');
if (parts.length < 2) {
parts[1] = '';
} else {
parts[1] = decodeURIComponent(parts[1]);
}
)
return parts as [string, string];
})
.reduce<{ [key: string]: string }>((c, x) => {
c[x[0]] = x[1];
return c;