decidim-comments 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -0
  3. data/app/assets/javascripts/decidim/comments/bundle.js +44 -44
  4. data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
  5. data/app/assets/javascripts/decidim/comments/comments.js.erb +2 -0
  6. data/app/frontend/application/{apollo_client.js → apollo_client.ts} +5 -5
  7. data/app/frontend/application/application.component.test.tsx +36 -0
  8. data/app/frontend/application/application.component.tsx +37 -0
  9. data/app/frontend/application/icon.component.test.tsx +49 -0
  10. data/app/frontend/application/icon.component.tsx +35 -0
  11. data/app/frontend/comments/{add_comment_form.component.test.jsx → add_comment_form.component.test.tsx} +98 -92
  12. data/app/frontend/comments/{add_comment_form.component.jsx → add_comment_form.component.tsx} +152 -153
  13. data/app/frontend/comments/{comment.component.test.jsx → comment.component.test.tsx} +59 -71
  14. data/app/frontend/comments/{comment.component.jsx → comment.component.tsx} +114 -116
  15. data/app/frontend/comments/comment_order_selector.component.test.tsx +21 -0
  16. data/app/frontend/comments/comment_order_selector.component.tsx +88 -0
  17. data/app/frontend/comments/comment_thread.component.test.tsx +65 -0
  18. data/app/frontend/comments/comment_thread.component.tsx +70 -0
  19. data/app/frontend/comments/{comments.component.test.jsx → comments.component.test.tsx} +38 -81
  20. data/app/frontend/comments/{comments.component.jsx → comments.component.tsx} +49 -63
  21. data/app/frontend/comments/down_vote_button.component.test.tsx +39 -0
  22. data/app/frontend/comments/down_vote_button.component.tsx +89 -0
  23. data/app/frontend/comments/up_vote_button.component.test.tsx +39 -0
  24. data/app/frontend/comments/up_vote_button.component.tsx +89 -0
  25. data/app/frontend/comments/vote_button.component.tsx +36 -0
  26. data/app/frontend/comments/{vote_button_component.test.jsx → vote_button_component.test.tsx} +16 -20
  27. data/app/frontend/entry.ts +19 -0
  28. data/app/frontend/{comments → fragments}/add_comment_form_commentable.fragment.graphql +1 -1
  29. data/app/frontend/{comments → fragments}/add_comment_form_session.fragment.graphql +1 -1
  30. data/app/frontend/{comments → fragments}/comment.fragment.graphql +3 -1
  31. data/app/frontend/{comments → fragments}/comment_data.fragment.graphql +6 -3
  32. data/app/frontend/{comments → fragments}/comment_thread.fragment.graphql +3 -1
  33. data/app/frontend/{comments/down_vote.fragment.graphql → fragments/down_vote_button.fragment.graphql} +2 -2
  34. data/app/frontend/{comments/up_vote.fragment.graphql → fragments/up_vote_button.fragment.graphql} +2 -2
  35. data/app/frontend/{comments/add_comment_form.mutation.graphql → mutations/add_comment.mutation.graphql} +3 -1
  36. data/app/frontend/{comments → mutations}/down_vote.mutation.graphql +3 -1
  37. data/app/frontend/{comments → mutations}/up_vote.mutation.graphql +3 -1
  38. data/app/frontend/{comments → queries}/comments.query.graphql +4 -1
  39. data/app/frontend/support/{asset_url.js → asset_url.ts} +1 -1
  40. data/app/frontend/support/{generate_comments_data.js → generate_comments_data.ts} +11 -6
  41. data/app/frontend/support/{generate_user_data.js → generate_user_data.ts} +2 -2
  42. data/app/frontend/support/{generate_user_group_data.js → generate_user_group_data.ts} +2 -2
  43. data/app/frontend/support/graphql_transformer.js +32 -0
  44. data/app/frontend/support/load_translations.ts +44 -0
  45. data/app/frontend/support/{require_all.js → require_all.ts} +1 -1
  46. data/app/frontend/support/{resolve_graphql_query.js → resolve_graphql_query.ts} +7 -7
  47. data/app/frontend/support/schema.ts +119 -0
  48. data/config/locales/eu.yml +29 -5
  49. metadata +49 -51
  50. data/app/frontend/application/application.component.jsx +0 -37
  51. data/app/frontend/application/application.component.test.jsx +0 -33
  52. data/app/frontend/application/icon.component.jsx +0 -26
  53. data/app/frontend/application/icon.component.test.jsx +0 -53
  54. data/app/frontend/comments/comment_order_selector.component.jsx +0 -72
  55. data/app/frontend/comments/comment_order_selector.component.test.jsx +0 -20
  56. data/app/frontend/comments/comment_thread.component.jsx +0 -75
  57. data/app/frontend/comments/comment_thread.component.test.jsx +0 -83
  58. data/app/frontend/comments/down_vote_button.component.jsx +0 -98
  59. data/app/frontend/comments/down_vote_button.component.test.jsx +0 -48
  60. data/app/frontend/comments/featured_comment.component.jsx +0 -23
  61. data/app/frontend/comments/featured_comment.component.test.jsx +0 -15
  62. data/app/frontend/comments/up_vote_button.component.jsx +0 -98
  63. data/app/frontend/comments/up_vote_button.component.test.jsx +0 -48
  64. data/app/frontend/comments/vote_button.component.jsx +0 -32
  65. data/app/frontend/entry.js +0 -17
  66. data/app/frontend/entry.test.js +0 -31
  67. data/app/frontend/support/load_translations.js +0 -23
  68. data/app/frontend/support/stub_component.js +0 -29
@@ -0,0 +1,119 @@
1
+ // This file was automatically generated and should not be edited.
2
+ /* tslint:disable */
3
+
4
+ export interface AddCommentMutationVariables {
5
+ commentableId: string;
6
+ commentableType: string;
7
+ body: string;
8
+ alignment: number | null;
9
+ userGroupId: string | null;
10
+ }
11
+
12
+ export interface AddCommentMutation {
13
+ commentable: {
14
+ addComment: CommentThreadFragment & CommentFragment & CommentDataFragment & UpVoteFragment & DownVoteFragment,
15
+ } | null;
16
+ }
17
+
18
+ export interface DownVoteMutationVariables {
19
+ id: string;
20
+ }
21
+
22
+ export interface DownVoteMutation {
23
+ comment: {
24
+ downVote: CommentFragment & CommentDataFragment & UpVoteFragment & DownVoteFragment,
25
+ } | null;
26
+ }
27
+
28
+ export interface UpVoteMutationVariables {
29
+ id: string;
30
+ }
31
+
32
+ export interface UpVoteMutation {
33
+ comment: {
34
+ upVote: CommentFragment & CommentDataFragment & UpVoteFragment & DownVoteFragment,
35
+ } | null;
36
+ }
37
+
38
+ export interface GetCommentsQueryVariables {
39
+ commentableId: string;
40
+ commentableType: string;
41
+ orderBy: string | null;
42
+ }
43
+
44
+ export interface GetCommentsQuery {
45
+ session: AddCommentFormSessionFragment & {
46
+ user: {
47
+ name: string,
48
+ avatarUrl: string,
49
+ organizationName: string,
50
+ } | null,
51
+ } | null;
52
+ commentable: AddCommentFormCommentableFragment & {
53
+ acceptsNewComments: boolean,
54
+ commentsHaveAlignment: boolean,
55
+ commentsHaveVotes: boolean,
56
+ comments: Array< CommentThreadFragment & CommentFragment & CommentDataFragment & UpVoteFragment & DownVoteFragment & {
57
+ id: string,
58
+ } >,
59
+ };
60
+ }
61
+
62
+ export interface AddCommentFormCommentableFragment {
63
+ id: string;
64
+ type: string;
65
+ }
66
+
67
+ export interface AddCommentFormSessionFragment {
68
+ verifiedUserGroups: Array< {
69
+ id: string,
70
+ name: string,
71
+ } >;
72
+ }
73
+
74
+ export interface CommentDataFragment extends UpVoteFragment, DownVoteFragment {
75
+ id: string;
76
+ sgid: string;
77
+ type: string;
78
+ body: string;
79
+ createdAt: string;
80
+ author: {
81
+ name: string,
82
+ avatarUrl: string,
83
+ };
84
+ hasComments: boolean;
85
+ acceptsNewComments: boolean;
86
+ alignment: number | null;
87
+ alreadyReported: boolean;
88
+ }
89
+
90
+ export interface CommentThreadFragment extends CommentFragment, CommentDataFragment, UpVoteFragment, DownVoteFragment {
91
+ author: {
92
+ name: string,
93
+ avatarUrl: string
94
+ };
95
+ hasComments: boolean;
96
+ }
97
+
98
+ export interface CommentFragment extends CommentDataFragment, UpVoteFragment, DownVoteFragment {
99
+ comments: Array< CommentDataFragment & UpVoteFragment & DownVoteFragment & {
100
+ comments: Array< CommentDataFragment & UpVoteFragment & DownVoteFragment & {
101
+ comments: Array<CommentDataFragment & UpVoteFragment & DownVoteFragment>,
102
+ } >,
103
+ } >;
104
+ }
105
+
106
+ export interface DownVoteFragment {
107
+ id: string;
108
+ downVotes: number;
109
+ downVoted: boolean;
110
+ upVoted: boolean;
111
+ }
112
+
113
+ export interface UpVoteFragment {
114
+ id: string;
115
+ upVotes: number;
116
+ upVoted: boolean;
117
+ downVoted: boolean;
118
+ }
119
+ /* tslint:enable */
@@ -1,9 +1,18 @@
1
1
  eu:
2
+ activerecord:
3
+ errors:
4
+ messages:
5
+ cannot_have_comments: ezin zaio iruzkinik egin
2
6
  decidim:
3
7
  comments:
4
8
  comment_notification_mailer:
9
+ comment_created:
10
+ new_comment_html: 'Iruzkin berri bat dago, <b>%{commenter}</b> iruzkingilearena, hemen: <b>%{commentable_link}</b>'
5
11
  hello: Kaixo, %{name},
12
+ manage_email_subscriptions_html: 'Halako mezurik jaso nahi ez baduzu, aldatu konfigurazioa hemen: %{link}.'
6
13
  notifications_settings_link: jakinarazpenen konfigurazio-orria
14
+ reply_created:
15
+ new_reply_html: 'Iruzkin berri bat dago, <b>%{commenter}</b> iruzkingilearena, hemen: <b>%{commentable_link}</b>'
7
16
  mailer:
8
17
  comment_notification:
9
18
  comment_created:
@@ -12,6 +21,7 @@ eu:
12
21
  subject: Zure iruzkinetako bati erantzuna eman diote
13
22
  components:
14
23
  add_comment_form:
24
+ account_message: '<a href="%{sign_in_url}">Sartu zure kontuarekin</a> o <a href="%{sign_up_url}">erregistratu</a> zure iruzkina egiteko. '
15
25
  form:
16
26
  body:
17
27
  label: Iruzkina
@@ -19,23 +29,37 @@ eu:
19
29
  form_error: Testua behar da, eta ezin du izan %{length} karaktere baino gehiago.
20
30
  submit: Bidali
21
31
  user_group_id:
22
- label: 'Iruzkindu honela:'
32
+ label: 'Egin iruzkina honako honen gisa:'
23
33
  opinion:
24
34
  neutral: Neutrala
25
- title: Jarri hemen zure iruzkina
35
+ title: Egin hemen zure iruzkina
26
36
  comment:
27
37
  alignment:
28
38
  against: Aurka
29
39
  in_favor: Alde
30
40
  reply: Erantzuna
41
+ report:
42
+ action: Salatu
43
+ already_reported: Eduki hau jada salatuta dago, eta administratzaile batek berrikusiko du.
44
+ close: Itxi
45
+ description: Eduki hau desegokia da?
46
+ details: iruzkin gehigarriak
47
+ reasons:
48
+ does_not_belong: Bertan badago legez kontrako jardunik, suizidio-mehatxurik, informazio pertsonalik edo beste zernahi, zure ustez %{organization_name}-ri ez dagokionik.
49
+ offensive: Bertan badago arrazakeriarik, sexismorik, irainik, eraso pertsonalik, heriotza-mehatxurik, suizidio-eskaerarik edo beste edozein eratako gorroto-diskurtsorik.
50
+ spam: Bertan badago clickbait-ik, publizitaterik edo iruzurrik.
51
+ title: Salatu arazo bat
31
52
  comment_order_selector:
32
53
  order:
33
- best_rated: Balorazio hoberena
54
+ best_rated: Balorazio hoberenak
34
55
  most_discussed: Eztabaidatuenak
35
- older: Zaharrena
36
- recent: Berri-berria
56
+ older: Zaharrenak
57
+ recent: Berrienak
37
58
  title: 'Ordenatu honen arabera:'
59
+ comment_thread:
60
+ title: 'Solasaldia honekin: %{authorName}'
38
61
  comments:
62
+ blocked_comments_warning: Oraingo faseko iruzkinak desaktibatuta daude, baina aurreko faseetako iruzkinak irakur ditzakezu.
39
63
  loading: Iruzkinak kargatzen...
40
64
  title: "%{count} iruzkin"
41
65
  featured_comment:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
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-03-24 00:00:00.000000000 Z
13
+ date: 2017-04-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.0.6
21
+ version: 0.0.7
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.0.6
28
+ version: 0.0.7
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rails
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -60,14 +60,14 @@ dependencies:
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 0.0.6
63
+ version: 0.0.7
64
64
  type: :development
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.0.6
70
+ version: 0.0.7
71
71
  description: Pluggable comments system for some components.
72
72
  email:
73
73
  - josepjaume@gmail.com
@@ -86,50 +86,48 @@ files:
86
86
  - app/commands/decidim/comments/create_comment.rb
87
87
  - app/commands/decidim/comments/vote_comment.rb
88
88
  - app/forms/decidim/comments/comment_form.rb
89
- - app/frontend/application/apollo_client.js
90
- - app/frontend/application/application.component.jsx
91
- - app/frontend/application/application.component.test.jsx
92
- - app/frontend/application/icon.component.jsx
93
- - app/frontend/application/icon.component.test.jsx
94
- - app/frontend/comments/add_comment_form.component.jsx
95
- - app/frontend/comments/add_comment_form.component.test.jsx
96
- - app/frontend/comments/add_comment_form.mutation.graphql
97
- - app/frontend/comments/add_comment_form_commentable.fragment.graphql
98
- - app/frontend/comments/add_comment_form_session.fragment.graphql
99
- - app/frontend/comments/comment.component.jsx
100
- - app/frontend/comments/comment.component.test.jsx
101
- - app/frontend/comments/comment.fragment.graphql
102
- - app/frontend/comments/comment_data.fragment.graphql
103
- - app/frontend/comments/comment_order_selector.component.jsx
104
- - app/frontend/comments/comment_order_selector.component.test.jsx
105
- - app/frontend/comments/comment_thread.component.jsx
106
- - app/frontend/comments/comment_thread.component.test.jsx
107
- - app/frontend/comments/comment_thread.fragment.graphql
108
- - app/frontend/comments/comments.component.jsx
109
- - app/frontend/comments/comments.component.test.jsx
110
- - app/frontend/comments/comments.query.graphql
111
- - app/frontend/comments/down_vote.fragment.graphql
112
- - app/frontend/comments/down_vote.mutation.graphql
113
- - app/frontend/comments/down_vote_button.component.jsx
114
- - app/frontend/comments/down_vote_button.component.test.jsx
115
- - app/frontend/comments/featured_comment.component.jsx
116
- - app/frontend/comments/featured_comment.component.test.jsx
117
- - app/frontend/comments/up_vote.fragment.graphql
118
- - app/frontend/comments/up_vote.mutation.graphql
119
- - app/frontend/comments/up_vote_button.component.jsx
120
- - app/frontend/comments/up_vote_button.component.test.jsx
121
- - app/frontend/comments/vote_button.component.jsx
122
- - app/frontend/comments/vote_button_component.test.jsx
123
- - app/frontend/entry.js
124
- - app/frontend/entry.test.js
125
- - app/frontend/support/asset_url.js
126
- - app/frontend/support/generate_comments_data.js
127
- - app/frontend/support/generate_user_data.js
128
- - app/frontend/support/generate_user_group_data.js
129
- - app/frontend/support/load_translations.js
130
- - app/frontend/support/require_all.js
131
- - app/frontend/support/resolve_graphql_query.js
132
- - app/frontend/support/stub_component.js
89
+ - app/frontend/application/apollo_client.ts
90
+ - app/frontend/application/application.component.test.tsx
91
+ - app/frontend/application/application.component.tsx
92
+ - app/frontend/application/icon.component.test.tsx
93
+ - app/frontend/application/icon.component.tsx
94
+ - app/frontend/comments/add_comment_form.component.test.tsx
95
+ - app/frontend/comments/add_comment_form.component.tsx
96
+ - app/frontend/comments/comment.component.test.tsx
97
+ - app/frontend/comments/comment.component.tsx
98
+ - app/frontend/comments/comment_order_selector.component.test.tsx
99
+ - app/frontend/comments/comment_order_selector.component.tsx
100
+ - app/frontend/comments/comment_thread.component.test.tsx
101
+ - app/frontend/comments/comment_thread.component.tsx
102
+ - app/frontend/comments/comments.component.test.tsx
103
+ - app/frontend/comments/comments.component.tsx
104
+ - app/frontend/comments/down_vote_button.component.test.tsx
105
+ - app/frontend/comments/down_vote_button.component.tsx
106
+ - app/frontend/comments/up_vote_button.component.test.tsx
107
+ - app/frontend/comments/up_vote_button.component.tsx
108
+ - app/frontend/comments/vote_button.component.tsx
109
+ - app/frontend/comments/vote_button_component.test.tsx
110
+ - app/frontend/entry.ts
111
+ - app/frontend/fragments/add_comment_form_commentable.fragment.graphql
112
+ - app/frontend/fragments/add_comment_form_session.fragment.graphql
113
+ - app/frontend/fragments/comment.fragment.graphql
114
+ - app/frontend/fragments/comment_data.fragment.graphql
115
+ - app/frontend/fragments/comment_thread.fragment.graphql
116
+ - app/frontend/fragments/down_vote_button.fragment.graphql
117
+ - app/frontend/fragments/up_vote_button.fragment.graphql
118
+ - app/frontend/mutations/add_comment.mutation.graphql
119
+ - app/frontend/mutations/down_vote.mutation.graphql
120
+ - app/frontend/mutations/up_vote.mutation.graphql
121
+ - app/frontend/queries/comments.query.graphql
122
+ - app/frontend/support/asset_url.ts
123
+ - app/frontend/support/generate_comments_data.ts
124
+ - app/frontend/support/generate_user_data.ts
125
+ - app/frontend/support/generate_user_group_data.ts
126
+ - app/frontend/support/graphql_transformer.js
127
+ - app/frontend/support/load_translations.ts
128
+ - app/frontend/support/require_all.ts
129
+ - app/frontend/support/resolve_graphql_query.ts
130
+ - app/frontend/support/schema.ts
133
131
  - app/mailers/decidim/comments/comment_notification_mailer.rb
134
132
  - app/models/decidim/comments/abilities/admin_user.rb
135
133
  - app/models/decidim/comments/abilities/process_admin_user.rb
@@ -188,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
186
  version: '0'
189
187
  requirements: []
190
188
  rubyforge_project:
191
- rubygems_version: 2.6.8
189
+ rubygems_version: 2.6.11
192
190
  signing_key:
193
191
  specification_version: 4
194
192
  summary: Pluggable comments system for some components.
@@ -1,37 +0,0 @@
1
- import { Component, PropTypes } from 'react';
2
- import { ApolloProvider } from 'react-apollo';
3
- import { I18n } from 'react-i18nify';
4
- import moment from 'moment';
5
-
6
- import apolloClient from './apollo_client';
7
-
8
- /**
9
- * Wrapper component for all React applications using Apollo
10
- * @class
11
- * @augments Component
12
- */
13
- export default class Application extends Component {
14
- constructor(props) {
15
- const { locale } = props;
16
-
17
- I18n.setLocale(locale);
18
- moment.locale(locale);
19
-
20
- super(props);
21
- }
22
-
23
- render() {
24
- const { children } = this.props;
25
-
26
- return (
27
- <ApolloProvider client={apolloClient}>
28
- {children}
29
- </ApolloProvider>
30
- );
31
- }
32
- }
33
-
34
- Application.propTypes = {
35
- children: PropTypes.element.isRequired,
36
- locale: PropTypes.string.isRequired
37
- };
@@ -1,33 +0,0 @@
1
- import { shallow } from 'enzyme';
2
- import { I18n } from 'react-i18nify';
3
- import moment from 'moment';
4
-
5
- import Application from './application.component';
6
-
7
- describe('<Application />', () => {
8
- afterEach(() => {
9
- I18n.setLocale('en');
10
- });
11
-
12
- it("should set I18n locale to locale prop", () => {
13
- sinon.spy(I18n, 'setLocale');
14
- const locale = "ca";
15
- shallow(
16
- <Application locale={locale}>
17
- <div>My application</div>
18
- </Application>
19
- );
20
- expect(I18n.setLocale).to.have.been.calledWith(locale);
21
- });
22
-
23
- it("should set moment locale to locale prop", () => {
24
- sinon.spy(moment, 'locale');
25
- const locale = "ca";
26
- shallow(
27
- <Application locale={locale}>
28
- <div>My application</div>
29
- </Application>
30
- );
31
- expect(moment.locale).to.have.been.calledWith(locale);
32
- });
33
- });
@@ -1,26 +0,0 @@
1
- import { PropTypes } from 'react';
2
-
3
- import assetUrl from '../support/asset_url';
4
-
5
- const Icon = ({ name, iconExtraClassName }) => {
6
- if (navigator.userAgent.match(/PhantomJS/)) {
7
- return <span className={`icon ${iconExtraClassName} ${name}`}>{name}</span>;
8
- }
9
-
10
- return (
11
- <svg className={`icon ${iconExtraClassName} ${name}`}>
12
- <use xmlnsXlink="http://www.w3.org/1999/xlink" xlinkHref={`${assetUrl('icons.svg')}#${name}`} />
13
- </svg>
14
- );
15
- };
16
-
17
- Icon.defaultProps = {
18
- iconExtraClassName: 'icon--before'
19
- };
20
-
21
- Icon.propTypes = {
22
- name: PropTypes.string.isRequired,
23
- iconExtraClassName: PropTypes.string.isRequired
24
- };
25
-
26
- export default Icon;
@@ -1,53 +0,0 @@
1
- import { shallow, mount } from 'enzyme';
2
-
3
- import Icon from './icon.component';
4
-
5
- describe("<Icon /", () => {
6
- beforeEach(() => {
7
- window.DecidimComments = {
8
- assets: {
9
- 'icons.svg': '/assets/icons.svg'
10
- }
11
- };
12
- })
13
-
14
- describe("if navigator user agent is not PhantomJS", () => {
15
- let currentNavigator = null;
16
-
17
- beforeEach(() => {
18
- currentNavigator = window.navigator;
19
- window.navigator = {
20
- userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36"
21
- };
22
- });
23
-
24
- it("should render a svg with class defined by prop className", () => {
25
- const wrapper = shallow(<Icon name="icon-thumb-down" />);
26
- expect(wrapper.find('svg.icon-thumb-down')).to.be.present();
27
- });
28
-
29
- it("should render a svg icon using the 'icons.svg' url and name", () => {
30
- const wrapper = shallow(<Icon name="icon-thumb-up" />);
31
- expect(wrapper.find('svg use')).to.have.attr('xlink:href').equal('/assets/icons.svg#icon-thumb-up');
32
- });
33
-
34
- afterEach(() => {
35
- window.navigator = currentNavigator;
36
- });
37
- });
38
-
39
- it("should render a simple span with the icon name", () => {
40
- const wrapper = shallow(<Icon name="icon-thumb-up" />);
41
- expect(wrapper.find('span')).to.have.text('icon-thumb-up');
42
- });
43
-
44
- it("should have a default prop iconExtraClassName with value 'icon--before'", () => {
45
- const wrapper = mount(<Icon name="icon-thumb-up" />);
46
- expect(wrapper).to.have.prop('iconExtraClassName').equal('icon--before');
47
- });
48
-
49
- it("should render the svg with an extra class defined by iconExtraClassName", () => {
50
- const wrapper = mount(<Icon name="icon-thumb-up" iconExtraClassName="icon--small" />);
51
- expect(wrapper.find('.icon--small')).to.be.present();
52
- });
53
- });