decidim 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +42 -42
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/frontend/comments/comment.component.tsx +3 -3
- data/decidim-comments/app/frontend/comments/down_vote_button.component.test.tsx +19 -4
- data/decidim-comments/app/frontend/comments/down_vote_button.component.tsx +10 -1
- data/decidim-comments/app/frontend/comments/up_vote_button.component.test.tsx +19 -4
- data/decidim-comments/app/frontend/comments/up_vote_button.component.tsx +10 -1
- data/decidim-comments/app/frontend/comments/vote_button.component.tsx +8 -1
- data/decidim-comments/app/frontend/comments/vote_button_component.test.tsx +25 -6
- data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +1 -1
- data/decidim-proposals/spec/features/proposals_spec.rb +19 -0
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eeec3dc6198f888837c2af927f49cf8204ea305
|
4
|
+
data.tar.gz: 8f583b31a52255552123cbe9964f110bf8fc3f5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18d55e2a4088c9996034c08838ba86b1fbbf03fe10a61e82edac2b6f616e26e7ee67df700f7bba175e277d208a3b11761c6b2333ccbff365c1b6b96957a12ab6
|
7
|
+
data.tar.gz: e3972203ac8f11d8459ff22be8515a81c4eb3945ca5382fb1f64446ad642e14b056626ad1b7f9065a168c9f1151b258a8fc555c1fa42bcdc0ca0db698b02a595
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
decidim (0.3.
|
5
|
-
decidim-admin (= 0.3.
|
6
|
-
decidim-api (= 0.3.
|
7
|
-
decidim-budgets (= 0.3.
|
8
|
-
decidim-comments (= 0.3.
|
9
|
-
decidim-core (= 0.3.
|
10
|
-
decidim-meetings (= 0.3.
|
11
|
-
decidim-pages (= 0.3.
|
12
|
-
decidim-proposals (= 0.3.
|
13
|
-
decidim-results (= 0.3.
|
14
|
-
decidim-surveys (= 0.3.
|
15
|
-
decidim-system (= 0.3.
|
16
|
-
decidim-admin (0.3.
|
4
|
+
decidim (0.3.2)
|
5
|
+
decidim-admin (= 0.3.2)
|
6
|
+
decidim-api (= 0.3.2)
|
7
|
+
decidim-budgets (= 0.3.2)
|
8
|
+
decidim-comments (= 0.3.2)
|
9
|
+
decidim-core (= 0.3.2)
|
10
|
+
decidim-meetings (= 0.3.2)
|
11
|
+
decidim-pages (= 0.3.2)
|
12
|
+
decidim-proposals (= 0.3.2)
|
13
|
+
decidim-results (= 0.3.2)
|
14
|
+
decidim-surveys (= 0.3.2)
|
15
|
+
decidim-system (= 0.3.2)
|
16
|
+
decidim-admin (0.3.2)
|
17
17
|
active_link_to (~> 1.0.0)
|
18
|
-
decidim-core (= 0.3.
|
18
|
+
decidim-core (= 0.3.2)
|
19
19
|
devise (~> 4.2)
|
20
20
|
devise-i18n (~> 1.1.0)
|
21
21
|
devise_invitable (~> 1.7.0)
|
@@ -24,29 +24,29 @@ PATH
|
|
24
24
|
rails (~> 5.1.1)
|
25
25
|
rectify (~> 0.9.1)
|
26
26
|
sassc-rails (~> 1.3.0)
|
27
|
-
decidim-api (0.3.
|
27
|
+
decidim-api (0.3.2)
|
28
28
|
graphiql-rails (~> 1.4.1)
|
29
29
|
graphql (~> 1.6.0)
|
30
30
|
rack-cors (~> 0.4.0)
|
31
31
|
rails (~> 5.1.1)
|
32
32
|
sprockets-es6 (~> 0.9.2)
|
33
|
-
decidim-budgets (0.3.
|
34
|
-
decidim-comments (= 0.3.
|
35
|
-
decidim-core (= 0.3.
|
33
|
+
decidim-budgets (0.3.2)
|
34
|
+
decidim-comments (= 0.3.2)
|
35
|
+
decidim-core (= 0.3.2)
|
36
36
|
kaminari (~> 1.0.1)
|
37
37
|
rectify (~> 0.9.1)
|
38
38
|
searchlight (~> 4.1.0)
|
39
|
-
decidim-comments (0.3.
|
40
|
-
decidim-core (= 0.3.
|
39
|
+
decidim-comments (0.3.2)
|
40
|
+
decidim-core (= 0.3.2)
|
41
41
|
jquery-rails (~> 4.0)
|
42
42
|
rails (~> 5.1.1)
|
43
|
-
decidim-core (0.3.
|
43
|
+
decidim-core (0.3.2)
|
44
44
|
active_link_to (~> 1.0.4)
|
45
45
|
autoprefixer-rails (~> 7.1.1)
|
46
46
|
cancancan (~> 2.0.0)
|
47
47
|
carrierwave (~> 1.1.0)
|
48
48
|
date_validator (~> 0.9.0)
|
49
|
-
decidim-api (= 0.3.
|
49
|
+
decidim-api (= 0.3.2)
|
50
50
|
devise (~> 4.3)
|
51
51
|
devise-i18n (~> 1.1.0)
|
52
52
|
file_validators (~> 2.1.0)
|
@@ -73,36 +73,36 @@ PATH
|
|
73
73
|
sprockets-es6 (~> 0.9.2)
|
74
74
|
truncato (~> 0.7.9)
|
75
75
|
wisper (~> 2.0.0)
|
76
|
-
decidim-meetings (0.3.
|
76
|
+
decidim-meetings (0.3.2)
|
77
77
|
date_validator (~> 0.9)
|
78
|
-
decidim-core (= 0.3.
|
78
|
+
decidim-core (= 0.3.2)
|
79
79
|
httparty (~> 0.15.0)
|
80
80
|
jquery-tmpl-rails (~> 1.1.0)
|
81
81
|
kaminari (~> 1.0.1)
|
82
82
|
rectify (~> 0.8)
|
83
83
|
searchlight (~> 4.1.0)
|
84
|
-
decidim-pages (0.3.
|
85
|
-
decidim-comments (= 0.3.
|
86
|
-
decidim-core (= 0.3.
|
84
|
+
decidim-pages (0.3.2)
|
85
|
+
decidim-comments (= 0.3.2)
|
86
|
+
decidim-core (= 0.3.2)
|
87
87
|
rectify (~> 0.9.1)
|
88
|
-
decidim-proposals (0.3.
|
89
|
-
decidim-comments (= 0.3.
|
90
|
-
decidim-core (= 0.3.
|
88
|
+
decidim-proposals (0.3.2)
|
89
|
+
decidim-comments (= 0.3.2)
|
90
|
+
decidim-core (= 0.3.2)
|
91
91
|
kaminari (~> 1.0.1)
|
92
92
|
rectify (~> 0.9.1)
|
93
93
|
social-share-button (~> 0.10.0)
|
94
|
-
decidim-results (0.3.
|
95
|
-
decidim-comments (= 0.3.
|
96
|
-
decidim-core (= 0.3.
|
94
|
+
decidim-results (0.3.2)
|
95
|
+
decidim-comments (= 0.3.2)
|
96
|
+
decidim-core (= 0.3.2)
|
97
97
|
kaminari (~> 1.0.1)
|
98
98
|
rectify (~> 0.9.1)
|
99
99
|
searchlight (~> 4.1.0)
|
100
|
-
decidim-surveys (0.3.
|
101
|
-
decidim-core (= 0.3.
|
100
|
+
decidim-surveys (0.3.2)
|
101
|
+
decidim-core (= 0.3.2)
|
102
102
|
jquery-tmpl-rails (~> 1.1.0)
|
103
|
-
decidim-system (0.3.
|
103
|
+
decidim-system (0.3.2)
|
104
104
|
active_link_to (~> 1.0.0)
|
105
|
-
decidim-core (= 0.3.
|
105
|
+
decidim-core (= 0.3.2)
|
106
106
|
devise (~> 4.2)
|
107
107
|
devise-i18n (~> 1.1.0)
|
108
108
|
devise_invitable (~> 1.7.1)
|
@@ -115,14 +115,14 @@ PATH
|
|
115
115
|
PATH
|
116
116
|
remote: decidim-dev
|
117
117
|
specs:
|
118
|
-
decidim-dev (0.3.
|
118
|
+
decidim-dev (0.3.2)
|
119
119
|
byebug
|
120
120
|
capybara (~> 2.14.0)
|
121
121
|
capybara-screenshot (~> 1.0.14)
|
122
122
|
codecov (~> 0.1.9)
|
123
123
|
database_cleaner (~> 1.6.0)
|
124
124
|
db-query-matchers (~> 0.9.0)
|
125
|
-
decidim (= 0.3.
|
125
|
+
decidim (= 0.3.2)
|
126
126
|
factory_girl_rails
|
127
127
|
faker (~> 1.7.3)
|
128
128
|
i18n-tasks (= 0.9.15)
|
@@ -289,7 +289,7 @@ GEM
|
|
289
289
|
geocoder (1.4.4)
|
290
290
|
globalid (0.4.0)
|
291
291
|
activesupport (>= 4.2.0)
|
292
|
-
graphiql-rails (1.4.
|
292
|
+
graphiql-rails (1.4.2)
|
293
293
|
rails
|
294
294
|
graphql (1.6.3)
|
295
295
|
hashdiff (0.3.4)
|
@@ -444,8 +444,8 @@ GEM
|
|
444
444
|
rake
|
445
445
|
rake (12.0.0)
|
446
446
|
rb-fsevent (0.9.8)
|
447
|
-
rb-inotify (0.9.
|
448
|
-
ffi (>= 0.5.0)
|
447
|
+
rb-inotify (0.9.10)
|
448
|
+
ffi (>= 0.5.0, < 2)
|
449
449
|
rectify (0.9.1)
|
450
450
|
activemodel (>= 4.1.0)
|
451
451
|
activerecord (>= 4.1.0)
|
Binary file
|
@@ -202,13 +202,13 @@ class Comment extends React.Component<CommentProps, CommentState> {
|
|
202
202
|
* @returns {Void|DOMElement} - Render the upVote and downVote buttons or not
|
203
203
|
*/
|
204
204
|
private _renderVoteButtons() {
|
205
|
-
const { comment, votable } = this.props;
|
205
|
+
const { session, comment, votable } = this.props;
|
206
206
|
|
207
207
|
if (votable) {
|
208
208
|
return (
|
209
209
|
<div className="comment__votes">
|
210
|
-
<UpVoteButton comment={comment} />
|
211
|
-
<DownVoteButton comment={comment} />
|
210
|
+
<UpVoteButton session={session} comment={comment} />
|
211
|
+
<DownVoteButton session={session} comment={comment} />
|
212
212
|
</div>
|
213
213
|
);
|
214
214
|
}
|
@@ -5,21 +5,25 @@ import { DownVoteButton } from "./down_vote_button.component";
|
|
5
5
|
import VoteButton from "./vote_button.component";
|
6
6
|
|
7
7
|
import generateCommentsData from "../support/generate_comments_data";
|
8
|
+
import generateUserData from "../support/generate_user_data";
|
8
9
|
|
9
10
|
import { DownVoteButtonFragment } from "../support/schema";
|
10
11
|
|
11
12
|
describe("<DownVoteButton />", () => {
|
12
13
|
let comment: DownVoteButtonFragment;
|
14
|
+
let session: any = null;
|
13
15
|
const downVote = jasmine.createSpy("downVote");
|
14
16
|
|
15
17
|
beforeEach(() => {
|
16
18
|
const commentsData = generateCommentsData(1);
|
17
|
-
|
19
|
+
session = {
|
20
|
+
user: generateUserData(),
|
21
|
+
};
|
18
22
|
comment = commentsData[0];
|
19
23
|
});
|
20
24
|
|
21
25
|
it("should render a VoteButton component with the correct props", () => {
|
22
|
-
const wrapper = shallow(<DownVoteButton comment={comment} downVote={downVote} />);
|
26
|
+
const wrapper = shallow(<DownVoteButton session={session} comment={comment} downVote={downVote} />);
|
23
27
|
expect(wrapper.find(VoteButton).prop("buttonClassName")).toEqual("comment__votes--down");
|
24
28
|
expect(wrapper.find(VoteButton).prop("iconName")).toEqual("icon-chevron-bottom");
|
25
29
|
expect(wrapper.find(VoteButton).prop("votes")).toEqual(comment.downVotes);
|
@@ -27,13 +31,24 @@ describe("<DownVoteButton />", () => {
|
|
27
31
|
|
28
32
|
it("should pass disabled prop as true if comment downVoted is true", () => {
|
29
33
|
comment.downVoted = true;
|
30
|
-
const wrapper = shallow(<DownVoteButton comment={comment} downVote={downVote} />);
|
34
|
+
const wrapper = shallow(<DownVoteButton session={session} comment={comment} downVote={downVote} />);
|
31
35
|
expect(wrapper.find(VoteButton).prop("disabled")).toBeTruthy();
|
32
36
|
});
|
33
37
|
|
34
38
|
it("should pass disabled prop as true if comment downVoted is true", () => {
|
35
39
|
comment.downVoted = true;
|
36
|
-
const wrapper = shallow(<DownVoteButton comment={comment} downVote={downVote} />);
|
40
|
+
const wrapper = shallow(<DownVoteButton session={session} comment={comment} downVote={downVote} />);
|
37
41
|
expect(wrapper.find(VoteButton).prop("disabled")).toBeTruthy();
|
38
42
|
});
|
43
|
+
|
44
|
+
describe("when session is not present", () => {
|
45
|
+
beforeEach(() => {
|
46
|
+
session = null;
|
47
|
+
});
|
48
|
+
|
49
|
+
it("should pass userLoggedIn as false", () => {
|
50
|
+
const wrapper = shallow(<DownVoteButton session={session} comment={comment} downVote={downVote} />);
|
51
|
+
expect(wrapper.find(VoteButton).prop("userLoggedIn")).toBeFalsy();
|
52
|
+
});
|
53
|
+
});
|
39
54
|
});
|
@@ -4,6 +4,7 @@ import { graphql } from "react-apollo";
|
|
4
4
|
import VoteButton from "./vote_button.component";
|
5
5
|
|
6
6
|
import {
|
7
|
+
AddCommentFormSessionFragment,
|
7
8
|
CommentFragment,
|
8
9
|
DownVoteButtonFragment,
|
9
10
|
DownVoteMutation,
|
@@ -11,11 +12,15 @@ import {
|
|
11
12
|
} from "../support/schema";
|
12
13
|
|
13
14
|
interface DownVoteButtonProps {
|
15
|
+
session: AddCommentFormSessionFragment & {
|
16
|
+
user: any;
|
17
|
+
} | null;
|
14
18
|
comment: DownVoteButtonFragment;
|
15
19
|
downVote?: () => void;
|
16
20
|
}
|
17
21
|
|
18
22
|
export const DownVoteButton: React.SFC<DownVoteButtonProps> = ({
|
23
|
+
session,
|
19
24
|
comment: { downVotes, upVoted, downVoted },
|
20
25
|
downVote,
|
21
26
|
}) => {
|
@@ -27,14 +32,18 @@ export const DownVoteButton: React.SFC<DownVoteButtonProps> = ({
|
|
27
32
|
selectedClass = "is-vote-notselected";
|
28
33
|
}
|
29
34
|
|
35
|
+
const userLoggedIn = session && session.user;
|
36
|
+
const disabled = upVoted || downVoted;
|
37
|
+
|
30
38
|
return (
|
31
39
|
<VoteButton
|
32
40
|
buttonClassName="comment__votes--down"
|
33
41
|
iconName="icon-chevron-bottom"
|
34
42
|
votes={downVotes}
|
35
43
|
voteAction={downVote}
|
36
|
-
disabled={
|
44
|
+
disabled={disabled}
|
37
45
|
selectedClass={selectedClass}
|
46
|
+
userLoggedIn={userLoggedIn}
|
38
47
|
/>
|
39
48
|
);
|
40
49
|
};
|
@@ -5,21 +5,25 @@ import { UpVoteButton } from "./up_vote_button.component";
|
|
5
5
|
import VoteButton from "./vote_button.component";
|
6
6
|
|
7
7
|
import generateCommentsData from "../support/generate_comments_data";
|
8
|
+
import generateUserData from "../support/generate_user_data";
|
8
9
|
|
9
10
|
import { UpVoteButtonFragment } from "../support/schema";
|
10
11
|
|
11
12
|
describe("<UpVoteButton />", () => {
|
12
13
|
let comment: UpVoteButtonFragment;
|
14
|
+
let session: any = null;
|
13
15
|
const upVote = jasmine.createSpy("upVote");
|
14
16
|
|
15
17
|
beforeEach(() => {
|
16
18
|
const commentsData = generateCommentsData(1);
|
17
|
-
|
19
|
+
session = {
|
20
|
+
user: generateUserData(),
|
21
|
+
};
|
18
22
|
comment = commentsData[0];
|
19
23
|
});
|
20
24
|
|
21
25
|
it("should render a VoteButton component with the correct props", () => {
|
22
|
-
const wrapper = shallow(<UpVoteButton comment={comment} upVote={upVote} />);
|
26
|
+
const wrapper = shallow(<UpVoteButton session={session} comment={comment} upVote={upVote} />);
|
23
27
|
expect(wrapper.find(VoteButton).prop("buttonClassName")).toEqual("comment__votes--up");
|
24
28
|
expect(wrapper.find(VoteButton).prop("iconName")).toEqual("icon-chevron-top");
|
25
29
|
expect(wrapper.find(VoteButton).prop("votes")).toEqual(comment.upVotes);
|
@@ -27,13 +31,24 @@ describe("<UpVoteButton />", () => {
|
|
27
31
|
|
28
32
|
it("should pass disabled prop as true if comment upVoted is true", () => {
|
29
33
|
comment.upVoted = true;
|
30
|
-
const wrapper = shallow(<UpVoteButton comment={comment} upVote={upVote} />);
|
34
|
+
const wrapper = shallow(<UpVoteButton session={session} comment={comment} upVote={upVote} />);
|
31
35
|
expect(wrapper.find(VoteButton).prop("disabled")).toBeTruthy();
|
32
36
|
});
|
33
37
|
|
34
38
|
it("should pass disabled prop as true if comment downVoted is true", () => {
|
35
39
|
comment.downVoted = true;
|
36
|
-
const wrapper = shallow(<UpVoteButton comment={comment} upVote={upVote} />);
|
40
|
+
const wrapper = shallow(<UpVoteButton session={session} comment={comment} upVote={upVote} />);
|
37
41
|
expect(wrapper.find(VoteButton).prop("disabled")).toBeTruthy();
|
38
42
|
});
|
43
|
+
|
44
|
+
describe("when session is not present", () => {
|
45
|
+
beforeEach(() => {
|
46
|
+
session = null;
|
47
|
+
});
|
48
|
+
|
49
|
+
it("should pass userLoggedIn as false", () => {
|
50
|
+
const wrapper = shallow(<UpVoteButton session={session} comment={comment} upVote={upVote} />);
|
51
|
+
expect(wrapper.find(VoteButton).prop("userLoggedIn")).toBeFalsy();
|
52
|
+
});
|
53
|
+
});
|
39
54
|
});
|
@@ -4,6 +4,7 @@ import { graphql } from "react-apollo";
|
|
4
4
|
import VoteButton from "./vote_button.component";
|
5
5
|
|
6
6
|
import {
|
7
|
+
AddCommentFormSessionFragment,
|
7
8
|
CommentFragment,
|
8
9
|
GetCommentsQuery,
|
9
10
|
UpVoteButtonFragment,
|
@@ -11,11 +12,15 @@ import {
|
|
11
12
|
} from "../support/schema";
|
12
13
|
|
13
14
|
interface UpVoteButtonProps {
|
15
|
+
session: AddCommentFormSessionFragment & {
|
16
|
+
user: any;
|
17
|
+
} | null;
|
14
18
|
comment: UpVoteButtonFragment;
|
15
19
|
upVote?: () => void;
|
16
20
|
}
|
17
21
|
|
18
22
|
export const UpVoteButton: React.SFC<UpVoteButtonProps> = ({
|
23
|
+
session,
|
19
24
|
comment: { upVotes, upVoted, downVoted },
|
20
25
|
upVote,
|
21
26
|
}) => {
|
@@ -27,14 +32,18 @@ export const UpVoteButton: React.SFC<UpVoteButtonProps> = ({
|
|
27
32
|
selectedClass = "is-vote-notselected";
|
28
33
|
}
|
29
34
|
|
35
|
+
const userLoggedIn = session && session.user;
|
36
|
+
const disabled = upVoted || downVoted;
|
37
|
+
|
30
38
|
return (
|
31
39
|
<VoteButton
|
32
40
|
buttonClassName="comment__votes--up"
|
33
41
|
iconName="icon-chevron-top"
|
34
42
|
votes={upVotes}
|
35
43
|
voteAction={upVote}
|
36
|
-
disabled={
|
44
|
+
disabled={disabled}
|
37
45
|
selectedClass={selectedClass}
|
46
|
+
userLoggedIn={userLoggedIn}
|
38
47
|
/>
|
39
48
|
);
|
40
49
|
};
|
@@ -8,8 +8,13 @@ interface VoteButtonProps {
|
|
8
8
|
voteAction?: () => void;
|
9
9
|
disabled?: boolean;
|
10
10
|
selectedClass?: string;
|
11
|
+
userLoggedIn: boolean;
|
11
12
|
}
|
12
13
|
|
14
|
+
const preventDefault = (event: any) => {
|
15
|
+
event.preventDefault();
|
16
|
+
};
|
17
|
+
|
13
18
|
const VoteButton: React.SFC<VoteButtonProps> = ({
|
14
19
|
buttonClassName,
|
15
20
|
iconName,
|
@@ -17,11 +22,13 @@ const VoteButton: React.SFC<VoteButtonProps> = ({
|
|
17
22
|
voteAction,
|
18
23
|
disabled,
|
19
24
|
selectedClass,
|
25
|
+
userLoggedIn,
|
20
26
|
}) => (
|
21
27
|
<button
|
22
28
|
className={`${buttonClassName} ${selectedClass}`}
|
23
|
-
onClick={voteAction}
|
29
|
+
onClick={userLoggedIn ? voteAction : preventDefault}
|
24
30
|
disabled={disabled}
|
31
|
+
data-open={userLoggedIn ? null : "loginModal"}
|
25
32
|
>
|
26
33
|
<Icon name={iconName} iconExtraClassName="icon--small" />
|
27
34
|
{` ${votes}`}
|
@@ -5,35 +5,54 @@ import VoteButton from "./vote_button.component";
|
|
5
5
|
|
6
6
|
describe("<VoteButton />", () => {
|
7
7
|
const voteAction: jasmine.Spy = jasmine.createSpy("voteAction");
|
8
|
+
const preventDefault: jasmine.Spy = jasmine.createSpy("preventDefault");
|
9
|
+
|
10
|
+
beforeEach(() => {
|
11
|
+
voteAction.calls.reset();
|
12
|
+
preventDefault.calls.reset();
|
13
|
+
});
|
8
14
|
|
9
15
|
it("should render the number of votes passed as a prop", () => {
|
10
|
-
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} />);
|
16
|
+
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} userLoggedIn={true} />);
|
11
17
|
expect(wrapper.find("button").text()).toMatch(/10/);
|
12
18
|
});
|
13
19
|
|
14
20
|
it("should render a button with the given buttonClassName", () => {
|
15
|
-
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} />);
|
21
|
+
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} userLoggedIn={true} />);
|
16
22
|
expect(wrapper.find("button.vote-button").exists()).toBeTruthy();
|
17
23
|
});
|
18
24
|
|
19
25
|
it("should render a Icon component with the correct name prop", () => {
|
20
|
-
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} />);
|
26
|
+
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} userLoggedIn={true} />);
|
21
27
|
expect(wrapper.find(Icon).prop("name")).toEqual("vote-icon");
|
22
28
|
});
|
23
29
|
|
24
30
|
it("should call the voteAction prop on click", () => {
|
25
|
-
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} />);
|
31
|
+
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} userLoggedIn={true} />);
|
26
32
|
wrapper.find("button").simulate("click");
|
27
33
|
expect(voteAction).toHaveBeenCalled();
|
28
34
|
});
|
29
35
|
|
30
36
|
it("should disable the button based on the disabled prop", () => {
|
31
|
-
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} disabled={true} />);
|
37
|
+
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} disabled={true} userLoggedIn={true} />);
|
32
38
|
expect(wrapper.find("button").props()).toHaveProperty("disabled");
|
33
39
|
});
|
34
40
|
|
35
41
|
it("should render a button with the given selectedClass", () => {
|
36
|
-
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} disabled={true} selectedClass="is-vote-selected" />);
|
42
|
+
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} disabled={true} selectedClass="is-vote-selected" userLoggedIn={true} />);
|
37
43
|
expect(wrapper.find(".is-vote-selected").exists()).toBeTruthy();
|
38
44
|
});
|
45
|
+
|
46
|
+
describe("when userLoggedIn prop is false", () => {
|
47
|
+
it("should add data-open prop as 'loginModal' to the button", () => {
|
48
|
+
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} userLoggedIn={false} />);
|
49
|
+
expect(wrapper.find("button").prop("data-open")).toBe("loginModal");
|
50
|
+
});
|
51
|
+
|
52
|
+
it("should call the event preventDefault method", () => {
|
53
|
+
const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} userLoggedIn={false} />);
|
54
|
+
wrapper.find("button").simulate("click", { preventDefault });
|
55
|
+
expect(preventDefault).toHaveBeenCalled();
|
56
|
+
});
|
57
|
+
});
|
39
58
|
});
|
@@ -679,6 +679,25 @@ describe "Proposals", type: :feature do
|
|
679
679
|
end
|
680
680
|
end
|
681
681
|
end
|
682
|
+
|
683
|
+
context "when the user is logged in" do
|
684
|
+
before do
|
685
|
+
login_as user, scope: :user
|
686
|
+
end
|
687
|
+
|
688
|
+
it "can be filtered by category" do
|
689
|
+
create_list(:proposal, 3, feature: feature)
|
690
|
+
create(:proposal, feature: feature, category: category)
|
691
|
+
|
692
|
+
visit_feature
|
693
|
+
|
694
|
+
within "form.new_filter" do
|
695
|
+
select category.name[I18n.locale.to_s], from: "filter_category_id"
|
696
|
+
end
|
697
|
+
|
698
|
+
expect(page).to have_css(".card--proposal", count: 1)
|
699
|
+
end
|
700
|
+
end
|
682
701
|
end
|
683
702
|
|
684
703
|
context "when ordering" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-06-
|
13
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,154 +18,154 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.3.
|
21
|
+
version: 0.3.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.3.
|
28
|
+
version: 0.3.2
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: decidim-system
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.3.
|
35
|
+
version: 0.3.2
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.3.
|
42
|
+
version: 0.3.2
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: decidim-admin
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.3.
|
49
|
+
version: 0.3.2
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.3.
|
56
|
+
version: 0.3.2
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: decidim-api
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.3.
|
63
|
+
version: 0.3.2
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.3.
|
70
|
+
version: 0.3.2
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: decidim-pages
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.3.
|
77
|
+
version: 0.3.2
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - '='
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.3.
|
84
|
+
version: 0.3.2
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: decidim-comments
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - '='
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: 0.3.
|
91
|
+
version: 0.3.2
|
92
92
|
type: :runtime
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - '='
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.3.
|
98
|
+
version: 0.3.2
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: decidim-meetings
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
103
|
- - '='
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.3.
|
105
|
+
version: 0.3.2
|
106
106
|
type: :runtime
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - '='
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 0.3.
|
112
|
+
version: 0.3.2
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: decidim-proposals
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - '='
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0.3.
|
119
|
+
version: 0.3.2
|
120
120
|
type: :runtime
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - '='
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.3.
|
126
|
+
version: 0.3.2
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: decidim-results
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - '='
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0.3.
|
133
|
+
version: 0.3.2
|
134
134
|
type: :runtime
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
138
|
- - '='
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version: 0.3.
|
140
|
+
version: 0.3.2
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: decidim-budgets
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
145
|
- - '='
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
version: 0.3.
|
147
|
+
version: 0.3.2
|
148
148
|
type: :runtime
|
149
149
|
prerelease: false
|
150
150
|
version_requirements: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
152
|
- - '='
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version: 0.3.
|
154
|
+
version: 0.3.2
|
155
155
|
- !ruby/object:Gem::Dependency
|
156
156
|
name: decidim-surveys
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
159
|
- - '='
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version: 0.3.
|
161
|
+
version: 0.3.2
|
162
162
|
type: :runtime
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
166
|
- - '='
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version: 0.3.
|
168
|
+
version: 0.3.2
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: bundler
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|