@comicrelief/component-library 6.1.5 → 6.3.0
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.
- package/cypress/integration/components/Organisms/Donate.spec.js +247 -247
- package/dist/components/Atoms/Picture/Picture.md +6 -9
- package/dist/components/Atoms/Picture/Picture.test.js +5 -5
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.md +6 -8
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +3 -3
- package/dist/components/Molecules/Box/Box.md +5 -7
- package/dist/components/Molecules/Box/Box.test.js +3 -3
- package/dist/components/Molecules/Card/Card.md +5 -7
- package/dist/components/Molecules/Card/Card.test.js +5 -5
- package/dist/components/Molecules/CardDs/CardDs.md +8 -12
- package/dist/components/Molecules/CardDs/CardDs.test.js +3 -3
- package/dist/components/Molecules/PartnerLink/PartnerLink.md +2 -3
- package/dist/components/Molecules/PartnerLink/PartnerLink.test.js +3 -3
- package/dist/components/Molecules/Promo/Promo.md +13 -14
- package/dist/components/Molecules/Promo/Promo.test.js +5 -5
- package/dist/components/Molecules/SearchResult/SearchResult.md +12 -16
- package/dist/components/Molecules/SearchResult/SearchResult.test.js +5 -5
- package/dist/components/Molecules/SingleMessage/SingleMessage.md +37 -48
- package/dist/components/Molecules/SingleMessage/SingleMessage.test.js +15 -15
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.md +15 -20
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.test.js +3 -3
- package/dist/components/Organisms/Donate/Donate.js +35 -7
- package/dist/components/Organisms/Donate/Donate.md +148 -14
- package/dist/components/Organisms/Donate/Donate.style.js +61 -45
- package/dist/components/Organisms/Donate/Donate.test.js +7 -7
- package/dist/components/Organisms/Donate/Form/Form.js +11 -6
- package/dist/components/Organisms/Donate/Form/PopUpComponent.js +74 -0
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +6 -6
- package/dist/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +355 -399
- package/dist/components/Organisms/Donate/assets/close.svg +3 -0
- package/dist/components/Organisms/Membership/Membership.md +6 -6
- package/dist/components/Organisms/Membership/Membership.test.js +5 -5
- package/dist/styleguide/data/data.js +9 -3
- package/package.json +2 -1
- package/src/components/Atoms/Picture/Picture.md +6 -9
- package/src/components/Atoms/Picture/Picture.test.js +4 -5
- package/src/components/Molecules/ArticleTeaser/ArticleTeaser.md +6 -8
- package/src/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +3 -4
- package/src/components/Molecules/Box/Box.md +5 -7
- package/src/components/Molecules/Box/Box.test.js +2 -3
- package/src/components/Molecules/Card/Card.md +5 -7
- package/src/components/Molecules/Card/Card.test.js +3 -4
- package/src/components/Molecules/CardDs/CardDs.md +8 -12
- package/src/components/Molecules/CardDs/CardDs.test.js +3 -4
- package/src/components/Molecules/PartnerLink/PartnerLink.md +2 -3
- package/src/components/Molecules/PartnerLink/PartnerLink.test.js +2 -3
- package/src/components/Molecules/Promo/Promo.md +13 -14
- package/src/components/Molecules/Promo/Promo.test.js +5 -6
- package/src/components/Molecules/SearchResult/SearchResult.md +12 -16
- package/src/components/Molecules/SearchResult/SearchResult.test.js +5 -5
- package/src/components/Molecules/SingleMessage/SingleMessage.md +37 -48
- package/src/components/Molecules/SingleMessage/SingleMessage.test.js +15 -16
- package/src/components/Molecules/SingleMessageDS/SingleMessageDs.md +15 -20
- package/src/components/Molecules/SingleMessageDS/SingleMessageDs.test.js +3 -4
- package/src/components/Organisms/Donate/Donate.js +91 -50
- package/src/components/Organisms/Donate/Donate.md +148 -14
- package/src/components/Organisms/Donate/Donate.style.js +16 -1
- package/src/components/Organisms/Donate/Donate.test.js +7 -7
- package/src/components/Organisms/Donate/Form/Form.js +16 -8
- package/src/components/Organisms/Donate/Form/PopUpComponent.js +63 -0
- package/src/components/Organisms/Donate/GivingSelector/GivingSelector.js +6 -6
- package/src/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +355 -399
- package/src/components/Organisms/Donate/assets/close.svg +3 -0
- package/src/components/Organisms/Membership/Membership.md +6 -6
- package/src/components/Organisms/Membership/Membership.test.js +9 -14
- package/src/styleguide/data/data.js +12 -1
|
@@ -1,283 +1,283 @@
|
|
|
1
1
|
describe('Donate component', () => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
before(() => {
|
|
3
|
+
// go to donate component
|
|
4
|
+
cy.visit('/#donate');
|
|
5
|
+
});
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
describe('props and methods section', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
cy.get('[data-testid="Donate-container"] button[name="rsg-usage"]')
|
|
10
|
+
.contains('Props & methods')
|
|
11
|
+
.as('propsBtn');
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
cy.get('@propsBtn')
|
|
14
|
+
.closest('[class^=rsg--tabs]')
|
|
15
|
+
.as('container');
|
|
16
|
+
});
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
it('is present', () => {
|
|
19
|
+
cy.get('@propsBtn').should('exist');
|
|
20
|
+
});
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
it('does not show table initially', () => {
|
|
23
|
+
cy.get('@container')
|
|
24
|
+
.find('table')
|
|
25
|
+
.should('not.exist');
|
|
26
|
+
});
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
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');
|
|
34
33
|
});
|
|
34
|
+
});
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
describe('Donate Form align right section', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cy.get('[data-testid="Donate-example-1"]')
|
|
39
|
+
.as('container')
|
|
40
|
+
.find('[data-preview="Donate"]')
|
|
41
|
+
.as('preview');
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
cy.get('@container')
|
|
44
|
+
.find('button')
|
|
45
|
+
.contains('View Code')
|
|
46
|
+
.as('viewCodeBtn');
|
|
47
|
+
});
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
49
|
+
it('renders donate form align right preview', () => {
|
|
50
|
+
// monthly
|
|
51
|
+
cy.get('@container')
|
|
52
|
+
.find('label[for="give-once"]')
|
|
53
|
+
.contains('Single');
|
|
54
|
+
cy.get('@container')
|
|
55
|
+
.find('label[for="give-monthly"]')
|
|
56
|
+
.contains('Monthly')
|
|
57
|
+
.click();
|
|
58
|
+
cy.get('@container')
|
|
59
|
+
.find('#mship-1--moneyBuy-box2')
|
|
60
|
+
.should('exist')
|
|
61
|
+
.click();
|
|
62
|
+
cy.get('@container')
|
|
63
|
+
.find('[id="mship-1--MoneyBuy-userInput"]')
|
|
64
|
+
.should('have.value', '10')
|
|
65
|
+
.clear()
|
|
66
|
+
.type('15.99')
|
|
67
|
+
.clear()
|
|
68
|
+
.type(' ');
|
|
69
|
+
cy.get('@container')
|
|
70
|
+
.find('p:nth-child(5)')
|
|
71
|
+
.contains('Please enter an amount between £1 and £20000 and up to 2 decimal places');
|
|
72
|
+
cy.get('@container')
|
|
73
|
+
.find('[id="mship-1--MoneyBuy-userInput"]')
|
|
74
|
+
.type('15.999');
|
|
75
|
+
cy.get('@container')
|
|
76
|
+
.find('p:nth-child(5)')
|
|
77
|
+
.contains('Please enter an amount between £1 and £20000 and up to 2 decimal places');
|
|
78
|
+
cy.get('@container')
|
|
79
|
+
.find('form > fieldset > input')
|
|
80
|
+
.contains('Donate monthly');
|
|
81
|
+
cy.get('@container')
|
|
82
|
+
.find('h2')
|
|
83
|
+
.should('exist');
|
|
84
|
+
});
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
it('has view code button', () => {
|
|
87
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
88
|
+
});
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
it('shows code on click', () => {
|
|
91
|
+
cy.get('@viewCodeBtn').click();
|
|
92
|
+
cy.get('@container')
|
|
93
|
+
.find('textarea')
|
|
94
|
+
.should('exist');
|
|
95
|
+
});
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
97
|
+
it('closes code on click', () => {
|
|
98
|
+
cy.get('@viewCodeBtn').click();
|
|
100
99
|
});
|
|
100
|
+
});
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
describe('Donate Form align left section', () => {
|
|
103
|
+
beforeEach(() => {
|
|
104
|
+
cy.get('[data-testid="Donate-example-3"]')
|
|
105
|
+
.as('container')
|
|
106
|
+
.find('[data-preview="Donate"]')
|
|
107
|
+
.as('preview');
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
cy.get('@container')
|
|
110
|
+
.find('button')
|
|
111
|
+
.contains('View Code')
|
|
112
|
+
.as('viewCodeBtn');
|
|
113
|
+
});
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
115
|
+
it('renders donate form align left preview', () => {
|
|
116
|
+
cy.get('@container')
|
|
117
|
+
.find('label[for="give-once"]')
|
|
118
|
+
.contains('Single');
|
|
119
|
+
cy.get('@container')
|
|
120
|
+
.find('label[for="give-monthly"]')
|
|
121
|
+
.contains('Monthly');
|
|
122
|
+
cy.get('@container')
|
|
123
|
+
.find('#mship-1--moneyBuy-box2')
|
|
124
|
+
.should('exist')
|
|
125
|
+
.click();
|
|
126
|
+
cy.get('@container')
|
|
127
|
+
.find('[id="mship-1--MoneyBuy-userInput"]')
|
|
128
|
+
.should('have.value', '20')
|
|
129
|
+
.clear()
|
|
130
|
+
.type(' ');
|
|
131
|
+
cy.get('@container')
|
|
132
|
+
.find('p:nth-child(5)')
|
|
133
|
+
.contains('Please enter an amount between £1 and £20000 and up to 2 decimal places');
|
|
134
|
+
cy.get('@container')
|
|
135
|
+
.find('[id="mship-1--MoneyBuy-userInput"]')
|
|
136
|
+
.type('10.999');
|
|
137
|
+
cy.get('@container')
|
|
138
|
+
.find('p:nth-child(5)')
|
|
139
|
+
.should('contain', 'Please enter an amount between £1 and £20000 and up to 2 decimal places');
|
|
140
|
+
cy.get('@container')
|
|
141
|
+
.find('form > fieldset > input')
|
|
142
|
+
.contains('Donate now');
|
|
143
|
+
cy.get('@container')
|
|
144
|
+
.find('h2')
|
|
145
|
+
.should('exist');
|
|
146
|
+
});
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
it('has view code button', () => {
|
|
149
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
150
|
+
});
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
it('shows code on click', () => {
|
|
153
|
+
cy.get('@viewCodeBtn').click();
|
|
154
|
+
cy.get('@container')
|
|
155
|
+
.find('textarea')
|
|
156
|
+
.should('exist');
|
|
157
|
+
});
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
});
|
|
159
|
+
it('closes code on click', () => {
|
|
160
|
+
cy.get('@viewCodeBtn').click();
|
|
162
161
|
});
|
|
162
|
+
});
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
describe('Single Giving section', () => {
|
|
165
|
+
beforeEach(() => {
|
|
166
|
+
cy.get('[data-testid="Donate-example-5"]')
|
|
167
|
+
.as('container')
|
|
168
|
+
.find('[data-preview="Donate"]')
|
|
169
|
+
.as('preview');
|
|
170
170
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
cy.get('@container')
|
|
172
|
+
.find('button')
|
|
173
|
+
.contains('View Code')
|
|
174
|
+
.as('viewCodeBtn');
|
|
175
|
+
});
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
177
|
+
it('renders Single Giving preview', () => {
|
|
178
|
+
cy.get('@container')
|
|
179
|
+
.find('label[for="give-once"]')
|
|
180
|
+
.should('not.exist');
|
|
181
|
+
cy.get('@container')
|
|
182
|
+
.find('#mship-1--moneyBuy-box3')
|
|
183
|
+
.should('exist')
|
|
184
|
+
.click();
|
|
185
|
+
cy.get('@container')
|
|
186
|
+
.find('[id="mship-1--MoneyBuy-userInput"]')
|
|
187
|
+
.should('have.value', '30')
|
|
188
|
+
.clear()
|
|
189
|
+
.type('10.99')
|
|
190
|
+
.clear()
|
|
191
|
+
.type(' ');
|
|
192
|
+
cy.get('@container')
|
|
193
|
+
.find('p:nth-child(5)')
|
|
194
|
+
.contains('Please enter an amount between £1 and £20000 and up to 2 decimal places');
|
|
195
|
+
cy.get('@container')
|
|
196
|
+
.find('[id="mship-1--MoneyBuy-userInput"]')
|
|
197
|
+
.type('10.999');
|
|
198
|
+
cy.get('@container')
|
|
199
|
+
.find('p:nth-child(5)')
|
|
200
|
+
.contains('Please enter an amount between £1 and £20000 and up to 2 decimal places');
|
|
201
|
+
cy.get('@container')
|
|
202
|
+
.find('form > fieldset > input')
|
|
203
|
+
.contains('Donate now');
|
|
204
|
+
cy.get('@container')
|
|
205
|
+
.find('h2')
|
|
206
|
+
.should('exist');
|
|
207
|
+
});
|
|
208
208
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
it('has view code button', () => {
|
|
210
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
211
|
+
});
|
|
212
212
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
it('shows code on click', () => {
|
|
214
|
+
cy.get('@viewCodeBtn').click();
|
|
215
|
+
cy.get('@container')
|
|
216
|
+
.find('textarea')
|
|
217
|
+
.should('exist');
|
|
218
|
+
});
|
|
219
219
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
});
|
|
220
|
+
it('closes code on click', () => {
|
|
221
|
+
cy.get('@viewCodeBtn').click();
|
|
223
222
|
});
|
|
223
|
+
});
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
describe('Single Giving "No Money Buys" section', () => {
|
|
226
|
+
beforeEach(() => {
|
|
227
|
+
cy.get('[data-testid="Donate-example-7"]')
|
|
228
|
+
.as('container')
|
|
229
|
+
.find('[data-preview="Donate"]')
|
|
230
|
+
.as('preview');
|
|
231
231
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
cy.get('@container')
|
|
233
|
+
.find('button')
|
|
234
|
+
.contains('View Code')
|
|
235
|
+
.as('viewCodeBtn');
|
|
236
|
+
});
|
|
237
237
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
238
|
+
it('renders Single Giving "No Money Buys" preview', () => {
|
|
239
|
+
cy.get('@container')
|
|
240
|
+
.find('label[for="give-once"]')
|
|
241
|
+
.should('not.exist');
|
|
242
|
+
cy.get('@container')
|
|
243
|
+
.find('#mship-1--moneyBuy-box1')
|
|
244
|
+
.should('not.exist');
|
|
245
|
+
cy.get('@container')
|
|
246
|
+
.find('[id="mship-1--MoneyBuy-userInput"]')
|
|
247
|
+
.should('exist')
|
|
248
|
+
.clear()
|
|
249
|
+
.type('5')
|
|
250
|
+
.clear();
|
|
251
|
+
cy.get('@container')
|
|
252
|
+
.find('p:nth-child(4)')
|
|
253
|
+
.contains('Please enter an amount between £1 and £20000 and up to 2 decimal places');
|
|
254
|
+
cy.get('@container')
|
|
255
|
+
.find('[id="mship-1--MoneyBuy-userInput"]')
|
|
256
|
+
.type('10.999')
|
|
257
|
+
.clear()
|
|
258
|
+
.type('5')
|
|
259
|
+
.should('not.have', 'Please enter an amount between £1 and £20000 and up to 2 decimal places');
|
|
260
|
+
cy.get('@container')
|
|
261
|
+
.find('form > fieldset > input')
|
|
262
|
+
.contains('Donate');
|
|
263
|
+
cy.get('@container')
|
|
264
|
+
.find('h2')
|
|
265
|
+
.should('exist');
|
|
266
|
+
});
|
|
267
267
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
it('has view code button', () => {
|
|
269
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
270
|
+
});
|
|
271
271
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
272
|
+
it('shows code on click', () => {
|
|
273
|
+
cy.get('@viewCodeBtn').click();
|
|
274
|
+
cy.get('@container')
|
|
275
|
+
.find('textarea')
|
|
276
|
+
.should('exist');
|
|
277
|
+
});
|
|
278
278
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
});
|
|
279
|
+
it('closes code on click', () => {
|
|
280
|
+
cy.get('@viewCodeBtn').click();
|
|
282
281
|
});
|
|
282
|
+
});
|
|
283
283
|
});
|
|
@@ -3,19 +3,17 @@ Picture has depenciy of <a href="https://github.com/aFarkas/lazysizes#readme" st
|
|
|
3
3
|
Picture
|
|
4
4
|
|
|
5
5
|
```js
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
<Picture alt="test Image" imageLow={data.imageLow} images={data.images} />;
|
|
6
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;
|
|
7
|
+
<Picture alt="test Image" imageLow={defaultData.imageLow} images={defaultData.images} />;
|
|
9
8
|
```
|
|
10
9
|
|
|
11
10
|
Custom Size.
|
|
12
11
|
|
|
13
12
|
```js
|
|
14
|
-
const
|
|
15
|
-
<Picture
|
|
13
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;<Picture
|
|
16
14
|
alt="test Image"
|
|
17
|
-
imageLow={
|
|
18
|
-
images={
|
|
15
|
+
imageLow={defaultData.imageLow}
|
|
16
|
+
images={defaultData.images}
|
|
19
17
|
objectFit="cover"
|
|
20
18
|
width="300px"
|
|
21
19
|
height="200px"
|
|
@@ -25,6 +23,5 @@ const data = require('../../../styleguide/data/data').default;
|
|
|
25
23
|
Single image
|
|
26
24
|
|
|
27
25
|
```js
|
|
28
|
-
const
|
|
29
|
-
<Picture alt="test Image" image={data.image} objectFit="cover" />;
|
|
26
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;<Picture alt="test Image" image={defaultData.image} objectFit="cover" />;
|
|
30
27
|
```
|
|
@@ -10,20 +10,20 @@ var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWith
|
|
|
10
10
|
|
|
11
11
|
var _Picture = _interopRequireDefault(require("./Picture"));
|
|
12
12
|
|
|
13
|
-
var _data =
|
|
13
|
+
var _data = require("../../../styleguide/data/data");
|
|
14
14
|
|
|
15
15
|
it('renders correctly', function () {
|
|
16
16
|
var tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Picture.default, {
|
|
17
|
-
images: _data.
|
|
18
|
-
image: _data.
|
|
17
|
+
images: _data.defaultData.images,
|
|
18
|
+
image: _data.defaultData.image,
|
|
19
19
|
alt: "Test images"
|
|
20
20
|
})).toJSON();
|
|
21
21
|
expect(tree).toMatchInlineSnapshot("\n .c0 {\n display: block;\n width: 100%;\n height: auto;\n position: relative;\n }\n\n .c1 {\n width: 100%;\n height: auto;\n display: block;\n object-fit: none;\n }\n\n <div\n className=\"c0 lazyload\"\n height=\"auto\"\n width=\"100%\"\n >\n <img\n alt=\"Test images\"\n className=\"c1 lazyload\"\n data-lowsrc={null}\n data-sizes=\"auto\"\n data-src=\"http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg\"\n data-srcset=\"//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=200&h=150&q=50 200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=400&h=300&q=50 400w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=800&h=600&q=50 800w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1200&h=900&q=50 1200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1440&h=1080&q=50 1440w\"\n height=\"auto\"\n src=\"http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg\"\n srcSet=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"\n width=\"100%\"\n />\n </div>\n ");
|
|
22
22
|
});
|
|
23
23
|
it('renders correctly with custom props', function () {
|
|
24
24
|
var tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Picture.default, {
|
|
25
|
-
images: _data.
|
|
26
|
-
image: _data.
|
|
25
|
+
images: _data.defaultData.images,
|
|
26
|
+
image: _data.defaultData.image,
|
|
27
27
|
objectFit: "cover",
|
|
28
28
|
width: "200px",
|
|
29
29
|
height: "100px",
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
### Article teaser
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
|
-
const
|
|
5
|
-
<div style={{ display: 'flex', background: '#E1E2E3' }}>
|
|
4
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;<div style={{ display: 'flex', background: '#E1E2E3' }}>
|
|
6
5
|
<div style={{ margin: '1rem', width: '300px' }}>
|
|
7
6
|
<ArticleTeaser
|
|
8
7
|
href="/test"
|
|
9
|
-
images={
|
|
10
|
-
imageLow={
|
|
8
|
+
images={defaultData.images}
|
|
9
|
+
imageLow={defaultData.imageLow}
|
|
11
10
|
date=" 01 July 2019"
|
|
12
11
|
title="News article"
|
|
13
12
|
alt="Image's description"
|
|
@@ -17,8 +16,8 @@ const data = require('../../../styleguide/data/data').default;
|
|
|
17
16
|
<div style={{ margin: '1rem', width: '300px' }}>
|
|
18
17
|
<ArticleTeaser
|
|
19
18
|
href="/test"
|
|
20
|
-
images={
|
|
21
|
-
imageLow={
|
|
19
|
+
images={defaultData.images}
|
|
20
|
+
imageLow={defaultData.imageLow}
|
|
22
21
|
date=" 01 July 2019"
|
|
23
22
|
title="News article News article"
|
|
24
23
|
alt="Image's description"
|
|
@@ -31,8 +30,7 @@ const data = require('../../../styleguide/data/data').default;
|
|
|
31
30
|
### Article teaser: Press release
|
|
32
31
|
|
|
33
32
|
```js
|
|
34
|
-
const
|
|
35
|
-
<ArticleTeaser
|
|
33
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;<ArticleTeaser
|
|
36
34
|
href="/test"
|
|
37
35
|
category=""
|
|
38
36
|
date=" 01 July 2019"
|