@comicrelief/component-library 7.19.1 → 7.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/cypress/integration/components/atoms/button.spec.js +113 -0
  2. package/cypress/integration/components/atoms/buttonWithStates.spec.js +53 -0
  3. package/cypress/integration/components/atoms/checkbox.spec.js +68 -0
  4. package/cypress/integration/components/atoms/confetti.spec.js +52 -0
  5. package/cypress/integration/components/atoms/errorText.spec.js +51 -0
  6. package/cypress/integration/components/atoms/label.spec.js +104 -0
  7. package/cypress/integration/components/atoms/link.spec.js +207 -0
  8. package/cypress/integration/components/atoms/logo.spec.js +149 -0
  9. package/cypress/integration/components/atoms/pagination.spec.js +214 -0
  10. package/cypress/integration/components/atoms/picture.spec.js +147 -0
  11. package/cypress/integration/components/atoms/radioButton.spec.js +81 -0
  12. package/cypress/integration/components/atoms/richText.spec.js +75 -0
  13. package/cypress/integration/components/atoms/select.spec.js +89 -0
  14. package/cypress/integration/components/atoms/text.spec.js +180 -0
  15. package/cypress/integration/components/atoms/textArea.spec.js +91 -0
  16. package/cypress/integration/components/atoms/textInputWithDrop.spec.js +78 -0
  17. package/cypress/integration/components/molecules/accordion.spec.js +72 -0
  18. package/cypress/integration/components/molecules/articleTeaser.spec.js +110 -0
  19. package/cypress/integration/components/molecules/banner.spec.js +72 -0
  20. package/cypress/integration/components/molecules/box.spec.js +112 -0
  21. package/cypress/integration/components/molecules/card.spec.js +113 -0
  22. package/cypress/integration/components/molecules/chip.spec.js +70 -0
  23. package/cypress/integration/components/molecules/countdown.spec.js +73 -0
  24. package/cypress/integration/components/molecules/descriptor.spec.js +147 -0
  25. package/cypress/integration/components/molecules/doubleCopy.spec.js +81 -0
  26. package/cypress/integration/components/molecules/heroBanner.spec.js +71 -0
  27. package/cypress/integration/components/molecules/infoBanner.spec.js +71 -0
  28. package/cypress/integration/components/molecules/partnerLink.spec.js +70 -0
  29. package/cypress/integration/components/molecules/promo.spec.js +76 -0
  30. package/cypress/integration/components/{Molecules/SchoolLookup.spec.js → molecules/schoolLookup.spec.js} +6 -0
  31. package/cypress/integration/components/molecules/searchInput.spec.js +74 -0
  32. package/cypress/integration/components/molecules/searchResult.spec.js +202 -0
  33. package/cypress/integration/components/molecules/shareButton.spec.js +78 -0
  34. package/cypress/integration/components/molecules/simpleSchoolLookup.spec.js +84 -0
  35. package/cypress/integration/components/molecules/singleMessage.spec.js +537 -0
  36. package/cypress/integration/components/molecules/singleMessageDs.spec.js +248 -0
  37. package/cypress/integration/components/molecules/videoBanner.spec.js +140 -0
  38. package/cypress/integration/components/organisms/cookieBanner.spec.js +82 -0
  39. package/cypress/integration/components/organisms/footer.spec.js +166 -0
  40. package/dist/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +1 -1
  41. package/dist/components/Organisms/Footer/data/footerCopy.js +1 -1
  42. package/package.json +1 -1
  43. package/src/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +1 -1
  44. package/src/components/Organisms/Footer/data/footerCopy.js +1 -1
  45. package/cypress/integration/components/Atoms/Checkbox.spec.js +0 -69
  46. package/cypress/integration/components/Atoms/Link.spec.js +0 -217
  47. package/cypress/integration/components/Atoms/Logo.spec.js +0 -155
  48. package/cypress/integration/components/Atoms/Pagination.spec.js +0 -217
  49. package/cypress/integration/components/Atoms/Picture.spec.js +0 -147
  50. package/cypress/integration/components/Atoms/RadioButton.spec.js +0 -81
  51. package/cypress/integration/components/Atoms/RichText.spec.js +0 -75
  52. package/cypress/integration/components/Atoms/Select.spec.js +0 -89
  53. package/cypress/integration/components/Atoms/Text.spec.js +0 -180
  54. package/cypress/integration/components/Atoms/TextArea.spec.js +0 -91
  55. package/cypress/integration/components/Molecules/ArticleTeaser.spec.js +0 -111
  56. package/cypress/integration/components/Molecules/Box.spec.js +0 -112
  57. package/cypress/integration/components/Molecules/Card.spec.js +0 -113
  58. package/cypress/integration/components/Molecules/DoubleCopy.spec.js +0 -81
  59. package/cypress/integration/components/Molecules/HeroBanner.spec.js +0 -71
  60. package/cypress/integration/components/Molecules/InfoBanner.spec.js +0 -71
  61. package/cypress/integration/components/Molecules/PartnerLink.spec.js +0 -70
  62. package/cypress/integration/components/Molecules/Promo.spec.js +0 -76
  63. package/cypress/integration/components/Molecules/SearchInput.spec.js +0 -74
  64. package/cypress/integration/components/Molecules/SearchResult.spec.js +0 -202
  65. package/cypress/integration/components/Molecules/ShareButton.spec.js +0 -78
  66. package/cypress/integration/components/Molecules/SingleMessage.spec.js +0 -537
  67. package/cypress/integration/components/Molecules/VideoBanner.spec.js +0 -70
  68. package/cypress/integration/components/Organisms/CookieBanner.spec.js +0 -82
  69. package/cypress/integration/components/Organisms/Footer.spec.js +0 -166
  70. /package/cypress/integration/components/{Atoms/Input.spec.js → atoms/input.spec.js} +0 -0
  71. /package/cypress/integration/components/{Atoms/SocialIcons.spec.js → atoms/socialIcons.spec.js} +0 -0
  72. /package/cypress/integration/components/{Molecules/CardDs.spec.js → molecules/cardDs.spec.js} +0 -0
  73. /package/cypress/integration/components/{Molecules/Typeahead.spec.js → molecules/typeahead.spec.js} +0 -0
  74. /package/cypress/integration/components/{Organisms/Donate.spec.js → organisms/donate.spec.js} +0 -0
  75. /package/cypress/integration/components/{Organisms/EmailSignUp.spec.js → organisms/emailSignUp.spec.js} +0 -0
  76. /package/cypress/integration/components/{Organisms/Header.spec.js → organisms/header.spec.js} +0 -0
  77. /package/cypress/integration/components/{Atoms/MarketingPreferencesDSForm.spec.js → organisms/marketingPreferencesDSForm.spec.js} +0 -0
  78. /package/cypress/integration/components/{Organisms/Membership.spec.js → organisms/membership.spec.js} +0 -0
@@ -0,0 +1,149 @@
1
+ describe('Logo component', () => {
2
+ before(() => {
3
+ // go to logo component
4
+ cy.visit('/#logo');
5
+ });
6
+
7
+ describe('props and methods section', () => {
8
+ beforeEach(() => {
9
+ cy.get('[data-testid="Logo-container"] button[name="rsg-usage"]')
10
+ .contains('Props & methods')
11
+ .as('propsBtn');
12
+
13
+ cy.get('@propsBtn')
14
+ .closest('[class^=rsg--tabs]')
15
+ .as('container');
16
+ });
17
+
18
+ it('is present', () => {
19
+ cy.get('@propsBtn').should('exist');
20
+ });
21
+
22
+ it('does not show table initially', () => {
23
+ cy.get('@container')
24
+ .find('table')
25
+ .should('not.exist');
26
+ });
27
+
28
+ it('shows the table on button click', () => {
29
+ cy.get('@propsBtn').click();
30
+ cy.get('@container')
31
+ .find('table')
32
+ .should('contain', 'Prop name');
33
+ });
34
+ });
35
+
36
+ describe('CR logo section', () => {
37
+ beforeEach(() => {
38
+ cy.get('[data-testid="Logo-example-1"]')
39
+ .as('container')
40
+ .find('[data-preview="Logo"]')
41
+ .as('preview');
42
+
43
+ cy.get('@container')
44
+ .find('button')
45
+ .contains('View Code')
46
+ .as('viewCodeBtn');
47
+ });
48
+
49
+ it('should check CR logo', () => {
50
+ cy.get('[data-testid="Logo-examples"] h1[id="comic-relief-logo"]')
51
+ .should('exist')
52
+ .contains('Comic Relief Logo')
53
+ });
54
+
55
+ it('has view code button', () => {
56
+ cy.get('@viewCodeBtn').should('exist');
57
+ });
58
+
59
+ it('shows code on click', () => {
60
+ cy.get('@viewCodeBtn').click();
61
+ cy.get('@container')
62
+ .find('textarea')
63
+ .should('exist');
64
+ });
65
+
66
+ it('closes code on click', () => {
67
+ cy.get('@viewCodeBtn').click();
68
+ cy.get('@container')
69
+ .find('textarea')
70
+ .should('not.exist');
71
+ });
72
+ });
73
+
74
+ describe('SR logo section', () => {
75
+ beforeEach(() => {
76
+ cy.get('[data-testid="Logo-example-3"]')
77
+ .as('container')
78
+ .find('[data-preview="Logo"]')
79
+ .as('preview');
80
+
81
+ cy.get('@container')
82
+ .find('button')
83
+ .contains('View Code')
84
+ .as('viewCodeBtn');
85
+ });
86
+
87
+ it('should check SR logo', () => {
88
+ cy.get('[data-testid="Logo-examples"] h1[id="sport-relief-logo"]')
89
+ .should('exist')
90
+ .contains('Sport Relief Logo')
91
+ });
92
+
93
+ it('has view code button', () => {
94
+ cy.get('@viewCodeBtn').should('exist');
95
+ });
96
+
97
+ it('shows code on click', () => {
98
+ cy.get('@viewCodeBtn').click();
99
+ cy.get('@container')
100
+ .find('textarea')
101
+ .should('exist');
102
+ });
103
+
104
+ it('closes code on click', () => {
105
+ cy.get('@viewCodeBtn').click();
106
+ cy.get('@container')
107
+ .find('textarea')
108
+ .should('not.exist');
109
+ });
110
+ });
111
+
112
+ describe('SR game on logo section', () => {
113
+ beforeEach(() => {
114
+ cy.get('[data-testid="Logo-example-5"]')
115
+ .as('container')
116
+ .find('[data-preview="Logo"]')
117
+ .as('preview');
118
+
119
+ cy.get('@container')
120
+ .find('button')
121
+ .contains('View Code')
122
+ .as('viewCodeBtn');
123
+ });
124
+
125
+ it('should check SR game on logo', () => {
126
+ cy.get('[data-testid="Logo-examples"] h1[id="sport-relief-game-on-logo"]')
127
+ .should('exist')
128
+ .contains('Sport Relief Game On Logo');
129
+ });
130
+
131
+ it('has view code button', () => {
132
+ cy.get('@viewCodeBtn').should('exist');
133
+ });
134
+
135
+ it('shows code on click', () => {
136
+ cy.get('@viewCodeBtn').click();
137
+ cy.get('@container')
138
+ .find('textarea')
139
+ .should('exist');
140
+ });
141
+
142
+ it('closes code on click', () => {
143
+ cy.get('@viewCodeBtn').click();
144
+ cy.get('@container')
145
+ .find('textarea')
146
+ .should('not.exist');
147
+ });
148
+ });
149
+ });
@@ -0,0 +1,214 @@
1
+ describe('Pagination component', () => {
2
+ before(() => {
3
+ // go to pagination component
4
+ cy.visit('/#pagination');
5
+ });
6
+
7
+ describe('props and methods section', () => {
8
+ beforeEach(() => {
9
+ cy.get('[data-testid="Pagination-container"] button[name="rsg-usage"]')
10
+ .contains('Props & methods')
11
+ .as('propsBtn');
12
+
13
+ cy.get('@propsBtn')
14
+ .closest('[class^=rsg--tabs]')
15
+ .as('container');
16
+ });
17
+
18
+ it('is present', () => {
19
+ cy.get('@propsBtn').should('exist');
20
+ });
21
+
22
+ it('does not show table initially', () => {
23
+ cy.get('@container')
24
+ .find('table')
25
+ .should('not.exist');
26
+ });
27
+
28
+ it('shows the table on button click', () => {
29
+ cy.get('@propsBtn').click();
30
+ cy.get('@container')
31
+ .find('table')
32
+ .should('contain', 'Prop name');
33
+ });
34
+ });
35
+
36
+ describe('Pagination minimalist section', () => {
37
+ beforeEach(() => {
38
+ cy.get('[data-testid="Pagination-example-1"]')
39
+ .as('container')
40
+ .find('[data-preview="Pagination"]')
41
+ .as('preview');
42
+
43
+ cy.get('@container')
44
+ .find('button')
45
+ .contains('View Code')
46
+ .as('viewCodeBtn');
47
+ });
48
+
49
+ it('should check minimalist section', () => {
50
+ cy.get('[data-testid="Pagination-example-1"]')
51
+ .should('exist');
52
+ cy.get('[data-testid="Pagination-example-1"] ul')
53
+ .should('exist');
54
+ });
55
+
56
+ it('has view code button', () => {
57
+ cy.get('@viewCodeBtn').should('exist');
58
+ });
59
+
60
+ it('shows code on click', () => {
61
+ cy.get('@viewCodeBtn').click();
62
+ cy.get('@container')
63
+ .find('textarea')
64
+ .should('exist');
65
+ });
66
+
67
+ it('closes code on click', () => {
68
+ cy.get('@viewCodeBtn').click();
69
+ cy.get('@container')
70
+ .find('textarea')
71
+ .should('not.exist');
72
+ });
73
+ });
74
+
75
+ describe('Pagination full size section', () => {
76
+ beforeEach(() => {
77
+ cy.get('[data-testid="Pagination-example-3"]')
78
+ .as('container')
79
+ .find('[data-preview="Pagination"]')
80
+ .as('preview');
81
+
82
+ cy.get('@container')
83
+ .find('button')
84
+ .contains('View Code')
85
+ .as('viewCodeBtn');
86
+ });
87
+
88
+ it('verifies full size pagination', () => {
89
+ cy.get('[data-testid="Pagination-example-3"]')
90
+ .should('exist');
91
+ cy.get('[data-testid="Pagination-example-3"] ul')
92
+ .should('exist');
93
+ cy.get('[data-testid="Pagination-example-3"] [aria-label="First page"]')
94
+ .should('exist');
95
+ cy.get('[data-testid="Pagination-example-3"] [aria-label="Previous page"]')
96
+ .should('exist');
97
+ cy.get('[data-testid="Pagination-example-3"] [aria-label="Next page"]')
98
+ .should('exist');
99
+ cy.get('[data-testid="Pagination-example-3"] [aria-label="Last page"]')
100
+ });
101
+
102
+ it('has view code button', () => {
103
+ cy.get('@viewCodeBtn').should('exist');
104
+ });
105
+
106
+ it('shows code on click', () => {
107
+ cy.get('@viewCodeBtn').click();
108
+ cy.get('@container')
109
+ .find('textarea')
110
+ .should('exist');
111
+ });
112
+
113
+ it('closes code on click', () => {
114
+ cy.get('@viewCodeBtn').click();
115
+ cy.get('@container')
116
+ .find('textarea')
117
+ .should('not.exist');
118
+ });
119
+ });
120
+
121
+ describe('Pagination custom style section', () => {
122
+ beforeEach(() => {
123
+ cy.get('[data-testid="Pagination-example-5"]')
124
+ .as('container')
125
+ .find('[data-preview="Pagination"]')
126
+ .as('preview');
127
+
128
+ cy.get('@container')
129
+ .find('button')
130
+ .contains('View Code')
131
+ .as('viewCodeBtn');
132
+ });
133
+
134
+ it('should check custom style section exist', () => {
135
+ cy.get('[data-testid="Pagination-example-5"]')
136
+ .should('exist');
137
+ cy.get('[data-testid="Pagination-example-5"] ul')
138
+ .should('exist');
139
+ cy.get('[data-testid="Pagination-example-5"] [aria-label="First page"]')
140
+ .should('exist');
141
+ cy.get('[data-testid="Pagination-example-5"] [aria-label="Previous page"]')
142
+ .should('exist');
143
+ cy.get('[data-testid="Pagination-example-5"] [aria-label="Last page"]')
144
+ .should('exist');
145
+ cy.get('[data-testid="Pagination-example-5"] [aria-label="Next page"]')
146
+ .should('exist');
147
+ });
148
+
149
+ it('has view code button', () => {
150
+ cy.get('@viewCodeBtn').should('exist');
151
+ });
152
+
153
+ it('shows code on click', () => {
154
+ cy.get('@viewCodeBtn').click();
155
+ cy.get('@container')
156
+ .find('textarea')
157
+ .should('exist');
158
+ });
159
+
160
+ it('closes code on click', () => {
161
+ cy.get('@viewCodeBtn').click();
162
+ cy.get('@container')
163
+ .find('textarea')
164
+ .should('not.exist');
165
+ });
166
+ });
167
+
168
+ describe('Pagination custom labels section', () => {
169
+ beforeEach(() => {
170
+ cy.get('[data-testid="Pagination-example-7"]')
171
+ .as('container')
172
+ .find('[data-preview="Pagination"]')
173
+ .as('preview');
174
+
175
+ cy.get('@container')
176
+ .find('button')
177
+ .contains('View Code')
178
+ .as('viewCodeBtn');
179
+ });
180
+
181
+ it('should check custom style section exist', () => {
182
+ cy.get('[data-testid="Pagination-example-7"]')
183
+ .should('exist');
184
+ cy.get('[data-testid="Pagination-example-7"] ul')
185
+ .should('exist');
186
+ cy.get('[data-testid="Pagination-example-7"] [aria-label="First page"]')
187
+ .should('exist');
188
+ cy.get('[data-testid="Pagination-example-7"] [aria-label="Previous page"]')
189
+ .should('exist');
190
+ cy.get('[data-testid="Pagination-example-7"] [aria-label="Last page"]')
191
+ .should('exist');
192
+ cy.get('[data-testid="Pagination-example-7"] [aria-label="Next page"]')
193
+ .should('exist');
194
+ });
195
+
196
+ it('has view code button', () => {
197
+ cy.get('@viewCodeBtn').should('exist');
198
+ });
199
+
200
+ it('shows code on click', () => {
201
+ cy.get('@viewCodeBtn').click();
202
+ cy.get('@container')
203
+ .find('textarea')
204
+ .should('exist');
205
+ });
206
+
207
+ it('closes code on click', () => {
208
+ cy.get('@viewCodeBtn').click();
209
+ cy.get('@container')
210
+ .find('textarea')
211
+ .should('not.exist');
212
+ });
213
+ });
214
+ });
@@ -0,0 +1,147 @@
1
+ describe('Picture component', () => {
2
+ before(() => {
3
+ // go to picture component
4
+ cy.visit('/#picture');
5
+ cy.wait(2500)
6
+ });
7
+
8
+ describe('props and methods section', () => {
9
+ beforeEach(() => {
10
+ cy.get('[data-testid="Picture-container"] button[name="rsg-usage"]')
11
+ .contains('Props & methods')
12
+ .as('propsBtn');
13
+
14
+ cy.get('@propsBtn')
15
+ .closest('[class^=rsg--tabs]')
16
+ .as('container');
17
+ });
18
+
19
+ it('is present', () => {
20
+ cy.get('@propsBtn').should('exist');
21
+ });
22
+
23
+ it('does not show table initially', () => {
24
+ cy.get('@container')
25
+ .find('table')
26
+ .should('not.exist');
27
+ });
28
+
29
+ it('shows the table on button click', () => {
30
+ cy.get('@propsBtn').click();
31
+ cy.get('@container')
32
+ .find('table')
33
+ .should('contain', 'Prop name');
34
+ });
35
+ });
36
+
37
+ describe('Picture section', () => {
38
+ beforeEach(() => {
39
+ cy.get('[data-testid="Picture-example-1"]')
40
+ .as('container')
41
+ .find('[data-preview="Picture"]')
42
+ .as('preview');
43
+
44
+ cy.get('@container')
45
+ .find('button')
46
+ .contains('View Code')
47
+ .as('viewCodeBtn');
48
+ });
49
+
50
+ it('render picture section', () => {
51
+ cy.get('@container')
52
+ .should('exist')
53
+ });
54
+
55
+ it('has view code button', () => {
56
+ cy.get('@viewCodeBtn').should('exist');
57
+ });
58
+
59
+ it('shows code on click', () => {
60
+ cy.get('@viewCodeBtn').click();
61
+ cy.get('@container')
62
+ .find('textarea')
63
+ .should('exist');
64
+ });
65
+
66
+ it('closes code on click', () => {
67
+ cy.get('@viewCodeBtn').click();
68
+ cy.get('@container')
69
+ .find('textarea')
70
+ .should('not.exist');
71
+ });
72
+ });
73
+
74
+ describe('custom size picture section', () => {
75
+ beforeEach(() => {
76
+ cy.get('[data-testid="Picture-example-3"]')
77
+ .as('container')
78
+ .find('[data-preview="Picture"]')
79
+ .as('preview');
80
+
81
+ cy.get('@container')
82
+ .find('button')
83
+ .contains('View Code')
84
+ .as('viewCodeBtn');
85
+ });
86
+
87
+ it('should check custom size section', () => {
88
+ cy.get('@container')
89
+ .should('exist');
90
+ });
91
+
92
+ it('has view code button', () => {
93
+ cy.get('@viewCodeBtn').should('exist');
94
+ });
95
+
96
+ it('shows code on click', () => {
97
+ cy.get('@viewCodeBtn').click();
98
+ cy.get('@container')
99
+ .find('textarea')
100
+ .should('exist');
101
+ });
102
+
103
+ it('closes code on click', () => {
104
+ cy.get('@viewCodeBtn').click();
105
+ cy.get('@container')
106
+ .find('textarea')
107
+ .should('not.exist');
108
+ });
109
+ });
110
+
111
+ describe('Single image section', () => {
112
+ beforeEach(() => {
113
+ cy.get('[data-testid="Picture-example-5"]')
114
+ .as('container')
115
+ .find('[data-preview="Picture"]')
116
+ .as('preview');
117
+
118
+ cy.get('@container')
119
+ .find('button')
120
+ .contains('View Code')
121
+ .as('viewCodeBtn');
122
+ });
123
+
124
+ it('should check custom size picture section', () => {
125
+ cy.get('@container')
126
+ .should('exist');
127
+ });
128
+
129
+ it('has view code button', () => {
130
+ cy.get('@viewCodeBtn').should('exist');
131
+ });
132
+
133
+ it('shows code on click', () => {
134
+ cy.get('@viewCodeBtn').click();
135
+ cy.get('@container')
136
+ .find('textarea')
137
+ .should('exist');
138
+ });
139
+
140
+ it('closes code on click', () => {
141
+ cy.get('@viewCodeBtn').click();
142
+ cy.get('@container')
143
+ .find('textarea')
144
+ .should('not.exist');
145
+ });
146
+ });
147
+ });
@@ -0,0 +1,81 @@
1
+ describe('Radio Button component', () => {
2
+ before(() => {
3
+ // go to radio button component
4
+ cy.visit('/#radiobutton');
5
+ cy.wait(2500)
6
+ });
7
+
8
+ describe('props and methods section', () => {
9
+ beforeEach(() => {
10
+ cy.get('[data-testid="RadioButton-container"] button[name="rsg-usage"]')
11
+ .contains('Props & methods')
12
+ .as('propsBtn');
13
+
14
+ cy.get('@propsBtn')
15
+ .closest('[class^=rsg--tabs]')
16
+ .as('container');
17
+ });
18
+
19
+ it('is present', () => {
20
+ cy.get('@propsBtn').should('exist');
21
+ });
22
+
23
+ it('does not show table initially', () => {
24
+ cy.get('@container')
25
+ .find('table')
26
+ .should('not.exist');
27
+ });
28
+
29
+ it('shows the table on button click', () => {
30
+ cy.get('@propsBtn').click();
31
+ cy.get('@container')
32
+ .find('table')
33
+ .should('contain', 'Prop name');
34
+ });
35
+ });
36
+
37
+ describe('Radio button section', () => {
38
+ beforeEach(() => {
39
+ cy.get('[data-testid="RadioButton-example-1"]')
40
+ .as('container')
41
+ .find('[data-preview="RadioButton"]')
42
+ .as('preview');
43
+
44
+ cy.get('@container')
45
+ .find('button')
46
+ .contains('View Code')
47
+ .as('viewCodeBtn');
48
+ });
49
+
50
+ it('renders radio button preview', () => {
51
+ cy.get('@container')
52
+ .find('label')
53
+ .first()
54
+ .click();
55
+ cy.get('@container')
56
+ .find('label:nth-child(2)')
57
+ .click();
58
+ cy.get('@container')
59
+ .find('label:nth-child(3)')
60
+ .click();
61
+ });
62
+
63
+ it('has view code button', () => {
64
+ cy.get('@viewCodeBtn').should('exist');
65
+ });
66
+
67
+ it('shows code on click', () => {
68
+ cy.get('@viewCodeBtn').click();
69
+ cy.get('@container')
70
+ .find('textarea')
71
+ .should('exist');
72
+ });
73
+
74
+ it('closes code on click', () => {
75
+ cy.get('@viewCodeBtn').click();
76
+ cy.get('@container')
77
+ .find('textarea')
78
+ .should('not.exist');
79
+ });
80
+ });
81
+ });
@@ -0,0 +1,75 @@
1
+ describe('RichText component', () => {
2
+ before(() => {
3
+ // go to rich text component
4
+ cy.visit('/#richtext');
5
+ cy.wait(2500)
6
+ });
7
+
8
+ describe('props and methods section', () => {
9
+ beforeEach(() => {
10
+ cy.get('[data-testid="RichText-container"] button[name="rsg-usage"]')
11
+ .contains('Props & methods')
12
+ .as('propsBtn');
13
+
14
+ cy.get('@propsBtn')
15
+ .closest('[class^=rsg--tabs]')
16
+ .as('container');
17
+ });
18
+
19
+ it('is present', () => {
20
+ cy.get('@propsBtn').should('exist');
21
+ });
22
+
23
+ it('does not show table initially', () => {
24
+ cy.get('@container')
25
+ .find('table')
26
+ .should('not.exist');
27
+ });
28
+
29
+ it('shows the table on button click', () => {
30
+ cy.get('@propsBtn').click();
31
+ cy.get('@container')
32
+ .find('table')
33
+ .should('contain', 'Prop name');
34
+ });
35
+ });
36
+
37
+ describe('Rich text section', () => {
38
+ beforeEach(() => {
39
+ cy.get('[data-testid="RichText-example-1"]')
40
+ .as('container')
41
+ .find('[data-preview="RichText"]')
42
+ .as('preview');
43
+
44
+ cy.get('@container')
45
+ .find('button')
46
+ .contains('View Code')
47
+ .as('viewCodeBtn');
48
+ });
49
+
50
+ it('should check rich text section', () => {
51
+ cy.get('@container')
52
+ .find('p')
53
+ .should('exist')
54
+ .contains('Some strong test markup')
55
+ });
56
+
57
+ it('has view code button', () => {
58
+ cy.get('@viewCodeBtn').should('exist');
59
+ });
60
+
61
+ it('shows code on click', () => {
62
+ cy.get('@viewCodeBtn').click();
63
+ cy.get('@container')
64
+ .find('textarea')
65
+ .should('exist');
66
+ });
67
+
68
+ it('closes code on click', () => {
69
+ cy.get('@viewCodeBtn').click();
70
+ cy.get('@container')
71
+ .find('textarea')
72
+ .should('not.exist');
73
+ });
74
+ });
75
+ });