@comicrelief/component-library 7.19.0 → 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.
- package/cypress/integration/components/atoms/button.spec.js +113 -0
- package/cypress/integration/components/atoms/buttonWithStates.spec.js +53 -0
- package/cypress/integration/components/atoms/checkbox.spec.js +68 -0
- package/cypress/integration/components/atoms/confetti.spec.js +52 -0
- package/cypress/integration/components/atoms/errorText.spec.js +51 -0
- package/cypress/integration/components/atoms/label.spec.js +104 -0
- package/cypress/integration/components/atoms/link.spec.js +207 -0
- package/cypress/integration/components/atoms/logo.spec.js +149 -0
- package/cypress/integration/components/atoms/pagination.spec.js +214 -0
- package/cypress/integration/components/atoms/picture.spec.js +147 -0
- package/cypress/integration/components/atoms/radioButton.spec.js +81 -0
- package/cypress/integration/components/atoms/richText.spec.js +75 -0
- package/cypress/integration/components/atoms/select.spec.js +89 -0
- package/cypress/integration/components/atoms/text.spec.js +180 -0
- package/cypress/integration/components/atoms/textArea.spec.js +91 -0
- package/cypress/integration/components/atoms/textInputWithDrop.spec.js +78 -0
- package/cypress/integration/components/molecules/accordion.spec.js +72 -0
- package/cypress/integration/components/molecules/articleTeaser.spec.js +110 -0
- package/cypress/integration/components/molecules/banner.spec.js +72 -0
- package/cypress/integration/components/molecules/box.spec.js +112 -0
- package/cypress/integration/components/molecules/card.spec.js +113 -0
- package/cypress/integration/components/molecules/chip.spec.js +70 -0
- package/cypress/integration/components/molecules/countdown.spec.js +73 -0
- package/cypress/integration/components/molecules/descriptor.spec.js +147 -0
- package/cypress/integration/components/molecules/doubleCopy.spec.js +81 -0
- package/cypress/integration/components/molecules/heroBanner.spec.js +71 -0
- package/cypress/integration/components/molecules/infoBanner.spec.js +71 -0
- package/cypress/integration/components/molecules/partnerLink.spec.js +70 -0
- package/cypress/integration/components/molecules/promo.spec.js +76 -0
- package/cypress/integration/components/{Molecules/SchoolLookup.spec.js → molecules/schoolLookup.spec.js} +6 -0
- package/cypress/integration/components/molecules/searchInput.spec.js +74 -0
- package/cypress/integration/components/molecules/searchResult.spec.js +202 -0
- package/cypress/integration/components/molecules/shareButton.spec.js +78 -0
- package/cypress/integration/components/molecules/simpleSchoolLookup.spec.js +84 -0
- package/cypress/integration/components/molecules/singleMessage.spec.js +537 -0
- package/cypress/integration/components/molecules/singleMessageDs.spec.js +248 -0
- package/cypress/integration/components/molecules/videoBanner.spec.js +140 -0
- package/cypress/integration/components/organisms/cookieBanner.spec.js +82 -0
- package/cypress/integration/components/organisms/footer.spec.js +166 -0
- package/dist/components/Molecules/VideoBanner/VideoBanner.js +14 -2
- package/dist/components/Molecules/VideoBanner/VideoBanner.md +1 -1
- package/dist/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +1 -1
- package/dist/components/Organisms/Footer/data/footerCopy.js +1 -1
- package/package.json +1 -1
- package/src/components/Molecules/VideoBanner/VideoBanner.js +9 -3
- package/src/components/Molecules/VideoBanner/VideoBanner.md +1 -1
- package/src/components/Organisms/Footer/__snapshots__/Footer.test.js.snap +1 -1
- package/src/components/Organisms/Footer/data/footerCopy.js +1 -1
- package/cypress/integration/components/Atoms/Checkbox.spec.js +0 -69
- package/cypress/integration/components/Atoms/Link.spec.js +0 -217
- package/cypress/integration/components/Atoms/Logo.spec.js +0 -155
- package/cypress/integration/components/Atoms/Pagination.spec.js +0 -217
- package/cypress/integration/components/Atoms/Picture.spec.js +0 -147
- package/cypress/integration/components/Atoms/RadioButton.spec.js +0 -81
- package/cypress/integration/components/Atoms/RichText.spec.js +0 -75
- package/cypress/integration/components/Atoms/Select.spec.js +0 -89
- package/cypress/integration/components/Atoms/Text.spec.js +0 -180
- package/cypress/integration/components/Atoms/TextArea.spec.js +0 -91
- package/cypress/integration/components/Molecules/ArticleTeaser.spec.js +0 -111
- package/cypress/integration/components/Molecules/Box.spec.js +0 -112
- package/cypress/integration/components/Molecules/Card.spec.js +0 -113
- package/cypress/integration/components/Molecules/DoubleCopy.spec.js +0 -81
- package/cypress/integration/components/Molecules/HeroBanner.spec.js +0 -71
- package/cypress/integration/components/Molecules/InfoBanner.spec.js +0 -71
- package/cypress/integration/components/Molecules/PartnerLink.spec.js +0 -70
- package/cypress/integration/components/Molecules/Promo.spec.js +0 -76
- package/cypress/integration/components/Molecules/SearchInput.spec.js +0 -74
- package/cypress/integration/components/Molecules/SearchResult.spec.js +0 -202
- package/cypress/integration/components/Molecules/ShareButton.spec.js +0 -78
- package/cypress/integration/components/Molecules/SingleMessage.spec.js +0 -537
- package/cypress/integration/components/Molecules/VideoBanner.spec.js +0 -70
- package/cypress/integration/components/Organisms/CookieBanner.spec.js +0 -82
- package/cypress/integration/components/Organisms/Footer.spec.js +0 -166
- /package/cypress/integration/components/{Atoms/Input.spec.js → atoms/input.spec.js} +0 -0
- /package/cypress/integration/components/{Atoms/SocialIcons.spec.js → atoms/socialIcons.spec.js} +0 -0
- /package/cypress/integration/components/{Molecules/CardDs.spec.js → molecules/cardDs.spec.js} +0 -0
- /package/cypress/integration/components/{Molecules/Typeahead.spec.js → molecules/typeahead.spec.js} +0 -0
- /package/cypress/integration/components/{Organisms/Donate.spec.js → organisms/donate.spec.js} +0 -0
- /package/cypress/integration/components/{Organisms/EmailSignUp.spec.js → organisms/emailSignUp.spec.js} +0 -0
- /package/cypress/integration/components/{Organisms/Header.spec.js → organisms/header.spec.js} +0 -0
- /package/cypress/integration/components/{Atoms/MarketingPreferencesDSForm.spec.js → organisms/marketingPreferencesDSForm.spec.js} +0 -0
- /package/cypress/integration/components/{Organisms/Membership.spec.js → organisms/membership.spec.js} +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
describe('SelectField component', () => {
|
|
2
|
+
before(() => {
|
|
3
|
+
// go to selectfield text component
|
|
4
|
+
cy.visit('/#selectfield');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
describe('props and methods section', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
cy.get('[data-testid="Select-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('Select Field section', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cy.get('[data-testid="Select-example-1"]')
|
|
39
|
+
.as('container')
|
|
40
|
+
.find('[data-preview="Select"]')
|
|
41
|
+
.as('preview');
|
|
42
|
+
|
|
43
|
+
cy.get('@container')
|
|
44
|
+
.find('button')
|
|
45
|
+
.contains('View Code')
|
|
46
|
+
.as('viewCodeBtn');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should check select field functionality', () => {
|
|
50
|
+
//first dropdown
|
|
51
|
+
cy.get('@container')
|
|
52
|
+
.find('h4')
|
|
53
|
+
.should('exist')
|
|
54
|
+
.contains('DROPDOWN MENU');
|
|
55
|
+
cy.get('@container')
|
|
56
|
+
.find('label:nth-child(2)')
|
|
57
|
+
.first()
|
|
58
|
+
.click();
|
|
59
|
+
|
|
60
|
+
//second dropdown
|
|
61
|
+
cy.get('@container')
|
|
62
|
+
.find('label:nth-child(4) > span')
|
|
63
|
+
.should('exist')
|
|
64
|
+
.contains('This is an error message');
|
|
65
|
+
cy.get('@container')
|
|
66
|
+
.find('label:nth-child(4)')
|
|
67
|
+
.first()
|
|
68
|
+
.click();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('has view code button', () => {
|
|
72
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('shows code on click', () => {
|
|
76
|
+
cy.get('@viewCodeBtn').click();
|
|
77
|
+
cy.get('@container')
|
|
78
|
+
.find('textarea')
|
|
79
|
+
.should('exist');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('closes code on click', () => {
|
|
83
|
+
cy.get('@viewCodeBtn').click();
|
|
84
|
+
cy.get('@container')
|
|
85
|
+
.find('textarea')
|
|
86
|
+
.should('not.exist');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
describe('Text component', () => {
|
|
2
|
+
before(() => {
|
|
3
|
+
// go to text component
|
|
4
|
+
cy.visit('/#text');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
describe('props and methods section', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
cy.get('[data-testid="Text-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('Text section', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cy.get('[data-testid="Text-example-0"]')
|
|
39
|
+
.as('container')
|
|
40
|
+
.find('[data-preview="Text"]')
|
|
41
|
+
.as('preview');
|
|
42
|
+
|
|
43
|
+
cy.get('@container')
|
|
44
|
+
.find('button')
|
|
45
|
+
.contains('View Code')
|
|
46
|
+
.as('viewCodeBtn');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('renders text section', () => {
|
|
50
|
+
//H1
|
|
51
|
+
cy.get('@container')
|
|
52
|
+
.find('h1')
|
|
53
|
+
.should('exist')
|
|
54
|
+
.contains('family: Anton weight: Regular size: 80px / 5rem / super');
|
|
55
|
+
//H2
|
|
56
|
+
cy.get('@container')
|
|
57
|
+
.find('h2')
|
|
58
|
+
.should('exist')
|
|
59
|
+
.contains('family: Anton weight: Regular size: 64px / 4rem / big');
|
|
60
|
+
//H3
|
|
61
|
+
cy.get('@container')
|
|
62
|
+
.find('h3')
|
|
63
|
+
.should('exist')
|
|
64
|
+
.contains('family: Anton weight: Regular size: 48px / 3rem / xxl');
|
|
65
|
+
//H4
|
|
66
|
+
cy.get('@container')
|
|
67
|
+
.find('h4')
|
|
68
|
+
.should('exist')
|
|
69
|
+
.contains('family: Anton weight: Regular size: 32px / 2rem / xl');
|
|
70
|
+
//H5
|
|
71
|
+
cy.get('@container')
|
|
72
|
+
.find('h4')
|
|
73
|
+
.should('exist')
|
|
74
|
+
.contains('family: Anton weight: Regular size: 24px / 1.5rem / l');
|
|
75
|
+
//Body1
|
|
76
|
+
cy.get('@container')
|
|
77
|
+
.find('p')
|
|
78
|
+
.should('exist')
|
|
79
|
+
.contains('family: Montserrat weight: Regular size: 20px / 1.25rem / m');
|
|
80
|
+
//Body2
|
|
81
|
+
cy.get('@container')
|
|
82
|
+
.find('p')
|
|
83
|
+
.should('exist')
|
|
84
|
+
.contains('family: Montserrat weight: Regular size: 16px / 1rem / s');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('has view code button', () => {
|
|
88
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('shows code on click', () => {
|
|
92
|
+
cy.get('@viewCodeBtn').click();
|
|
93
|
+
cy.get('@container')
|
|
94
|
+
.find('textarea')
|
|
95
|
+
.should('exist');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('closes code on click', () => {
|
|
99
|
+
cy.get('@viewCodeBtn').click();
|
|
100
|
+
cy.get('@container')
|
|
101
|
+
.find('textarea')
|
|
102
|
+
.should('not.exist');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe('Text section', () => {
|
|
107
|
+
beforeEach(() => {
|
|
108
|
+
cy.get('[data-testid="Text-example-2"]')
|
|
109
|
+
.as('container')
|
|
110
|
+
.find('[data-preview="Text"]')
|
|
111
|
+
.as('preview');
|
|
112
|
+
|
|
113
|
+
cy.get('@container')
|
|
114
|
+
.find('button')
|
|
115
|
+
.contains('View Code')
|
|
116
|
+
.as('viewCodeBtn');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('renders Sport Relief text section', () => {
|
|
120
|
+
//H1
|
|
121
|
+
cy.get('@container')
|
|
122
|
+
.find('h1')
|
|
123
|
+
.should('exist')
|
|
124
|
+
.contains('Heading 1');
|
|
125
|
+
//H2
|
|
126
|
+
cy.get('@container')
|
|
127
|
+
.find('h2')
|
|
128
|
+
.should('exist')
|
|
129
|
+
.contains('Heading 2');
|
|
130
|
+
//H3
|
|
131
|
+
cy.get('@container')
|
|
132
|
+
.find('h3')
|
|
133
|
+
.should('exist')
|
|
134
|
+
.contains('Heading 3');
|
|
135
|
+
//H4
|
|
136
|
+
cy.get('@container')
|
|
137
|
+
.find('h4')
|
|
138
|
+
.should('exist')
|
|
139
|
+
.contains('Heading 4');
|
|
140
|
+
//H5
|
|
141
|
+
cy.get('@container')
|
|
142
|
+
.find('h4')
|
|
143
|
+
.should('exist')
|
|
144
|
+
.contains('Heading 5');
|
|
145
|
+
//Body1
|
|
146
|
+
cy.get('@container')
|
|
147
|
+
.find('p')
|
|
148
|
+
.should('exist')
|
|
149
|
+
.contains('Body 1');
|
|
150
|
+
//Body2
|
|
151
|
+
cy.get('@container')
|
|
152
|
+
.find('p')
|
|
153
|
+
.should('exist')
|
|
154
|
+
.contains('Body 2');
|
|
155
|
+
//Bold and uppercase
|
|
156
|
+
cy.get('@container')
|
|
157
|
+
.find('p')
|
|
158
|
+
.should('exist')
|
|
159
|
+
.contains('Bold and Uppercase');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('has view code button', () => {
|
|
163
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('shows code on click', () => {
|
|
167
|
+
cy.get('@viewCodeBtn').click();
|
|
168
|
+
cy.get('@container')
|
|
169
|
+
.find('textarea')
|
|
170
|
+
.should('exist');
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('closes code on click', () => {
|
|
174
|
+
cy.get('@viewCodeBtn').click();
|
|
175
|
+
cy.get('@container')
|
|
176
|
+
.find('textarea')
|
|
177
|
+
.should('not.exist');
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
describe('TextArea component', () => {
|
|
2
|
+
before(() => {
|
|
3
|
+
// go to text area component
|
|
4
|
+
cy.visit('/#textarea');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
describe('props and methods section', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
cy.get('[data-testid="TextArea-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('Text Area section', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cy.get('[data-testid="TextArea-example-1"]')
|
|
39
|
+
.as('container')
|
|
40
|
+
.find('[data-preview="TextArea"]')
|
|
41
|
+
.as('preview');
|
|
42
|
+
|
|
43
|
+
cy.get('@container')
|
|
44
|
+
.find('button')
|
|
45
|
+
.contains('View Code')
|
|
46
|
+
.as('viewCodeBtn');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//Long copy/Message field
|
|
50
|
+
it('renders Long copy/Message field section', () => {
|
|
51
|
+
cy.get('@container')
|
|
52
|
+
.find('h4')
|
|
53
|
+
.should('exist')
|
|
54
|
+
.contains('Long copy/Message field');
|
|
55
|
+
cy.get('@container')
|
|
56
|
+
.find('label:nth-child(2) > textarea')
|
|
57
|
+
.should('exist')
|
|
58
|
+
.type('This is a test text');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
//Long copy/Message field with error message
|
|
62
|
+
it('renders Long copy/Message field with error message', () => {
|
|
63
|
+
cy.get('@container')
|
|
64
|
+
.find('h4')
|
|
65
|
+
.should('exist')
|
|
66
|
+
.contains('Long copy/Message field');
|
|
67
|
+
cy.get('@container')
|
|
68
|
+
.find('label:nth-child(4) > span')
|
|
69
|
+
.should('exist')
|
|
70
|
+
.contains('This is an error message');
|
|
71
|
+
cy.get('@container')
|
|
72
|
+
.find('label:nth-child(4) > textarea')
|
|
73
|
+
.type('This is a test text 2')
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('has view code button', () => {
|
|
77
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('shows code on click', () => {
|
|
81
|
+
cy.get('@viewCodeBtn').click();
|
|
82
|
+
cy.get('@container')
|
|
83
|
+
.find('textarea')
|
|
84
|
+
.should('exist');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('closes code on click', () => {
|
|
88
|
+
cy.get('@viewCodeBtn').click();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
describe('Text Input With Dropdown component', () => {
|
|
2
|
+
before(() => {
|
|
3
|
+
// go to textinputwithdropdown component
|
|
4
|
+
cy.visit('/#textinputwithdropdown');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
describe('props and methods section', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
cy.get('[data-testid="TextInputWithDropdown-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('TextInputWithDropdown section', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cy.get('[data-testid="TextInputWithDropdown-examples"]')
|
|
39
|
+
.as('container')
|
|
40
|
+
.find('[data-preview="TextInputWithDropdown"]')
|
|
41
|
+
.as('preview');
|
|
42
|
+
|
|
43
|
+
cy.get('@container')
|
|
44
|
+
.find('button')
|
|
45
|
+
.contains('View Code')
|
|
46
|
+
.as('viewCodeBtn');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('renders text input with dropdown field section', () => {
|
|
50
|
+
cy.get('@container')
|
|
51
|
+
.find('h1')
|
|
52
|
+
.should('exist')
|
|
53
|
+
.contains('TextInputWithDropdown');
|
|
54
|
+
cy.get('@container')
|
|
55
|
+
.find('#input-with-dropdown')
|
|
56
|
+
.should('exist')
|
|
57
|
+
.type('This is a test text');
|
|
58
|
+
cy.get('@container')
|
|
59
|
+
.find('ul > li:nth-child(2)') // first option
|
|
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
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
describe('Accordion component', () => {
|
|
2
|
+
before(() => {
|
|
3
|
+
// go to accordion component
|
|
4
|
+
cy.visit('/#accordion');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
describe('props and methods section', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
cy.get('[data-testid="Accordion-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('Accordion section', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cy.get('[data-testid="Accordion-example-1"]')
|
|
39
|
+
.as('container')
|
|
40
|
+
.find('[data-preview="Accordion"]')
|
|
41
|
+
.as('preview');
|
|
42
|
+
|
|
43
|
+
cy.get('@container')
|
|
44
|
+
.find('button')
|
|
45
|
+
.contains('View Code')
|
|
46
|
+
.as('viewCodeBtn');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('clicking svg dropdown icon should element p', () => {
|
|
50
|
+
cy.get('[data-testid="Accordion-example-1"] button > div').click();
|
|
51
|
+
cy.get('p').should('exist');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('has view code button', () => {
|
|
55
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('shows code on click', () => {
|
|
59
|
+
cy.get('@viewCodeBtn').click();
|
|
60
|
+
cy.get('@container')
|
|
61
|
+
.find('textarea')
|
|
62
|
+
.should('exist');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('closes code on click', () => {
|
|
66
|
+
cy.get('@viewCodeBtn').click();
|
|
67
|
+
cy.get('@container')
|
|
68
|
+
.find('textarea')
|
|
69
|
+
.should('not.exist');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
describe('ArticleTeaser component', () => {
|
|
2
|
+
before(() => {
|
|
3
|
+
// go to articleteaser component
|
|
4
|
+
cy.visit('/#articleteaser');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
describe('props and methods section', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
cy.get('[data-testid="ArticleTeaser-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('Article Teaser section', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cy.get('[data-testid="ArticleTeaser-example-1"]')
|
|
39
|
+
.as('container')
|
|
40
|
+
.find('[data-preview="ArticleTeaser"]')
|
|
41
|
+
.as('preview');
|
|
42
|
+
|
|
43
|
+
cy.get('@container')
|
|
44
|
+
.find('button')
|
|
45
|
+
.contains('View Code')
|
|
46
|
+
.as('viewCodeBtn');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//ArticleTeaser 1
|
|
50
|
+
it('renders article teaser', () => {
|
|
51
|
+
cy.get('@container')
|
|
52
|
+
.find('span')
|
|
53
|
+
.should('exist')
|
|
54
|
+
.contains(' 01 July 2019');
|
|
55
|
+
cy.get('@container')
|
|
56
|
+
.find('h3')
|
|
57
|
+
.should('exist')
|
|
58
|
+
.contains('News article');
|
|
59
|
+
cy.get('@container')
|
|
60
|
+
.find('span')
|
|
61
|
+
.should('exist')
|
|
62
|
+
.contains('4 min read');
|
|
63
|
+
|
|
64
|
+
//article teaser 2
|
|
65
|
+
cy.get('@container')
|
|
66
|
+
.find('div:nth-child(2) > article > a')
|
|
67
|
+
.as('container2')
|
|
68
|
+
.should('exist')
|
|
69
|
+
.contains('01 July 2019');
|
|
70
|
+
cy.get('@container2')
|
|
71
|
+
.find('h3')
|
|
72
|
+
.should('exist')
|
|
73
|
+
.contains('News article News article');
|
|
74
|
+
cy.get('@container2')
|
|
75
|
+
.find('span')
|
|
76
|
+
.should('exist')
|
|
77
|
+
.contains('4 min read');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
//ArticleTeaser: Press Release
|
|
81
|
+
it('renders article teaser : press release', () => {
|
|
82
|
+
cy.get('[data-testid="ArticleTeaser-example-3"]')
|
|
83
|
+
.find('span')
|
|
84
|
+
.should('exist')
|
|
85
|
+
.contains('01 July 2019');
|
|
86
|
+
cy.get('[data-testid="ArticleTeaser-example-3"]')
|
|
87
|
+
.find('h3')
|
|
88
|
+
.should('exist')
|
|
89
|
+
.contains('Press Release');
|
|
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
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
describe('Banner component', () => {
|
|
2
|
+
before(() => {
|
|
3
|
+
// go to banner component
|
|
4
|
+
cy.visit('/#banner');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
describe('props and methods section', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
cy.get('[data-testid="Banner-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('Banner section', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cy.get('[data-testid="Banner-example-1"]')
|
|
39
|
+
.as('container')
|
|
40
|
+
.find('[data-preview="Banner"]')
|
|
41
|
+
.as('preview');
|
|
42
|
+
|
|
43
|
+
cy.get('@container')
|
|
44
|
+
.find('button')
|
|
45
|
+
.contains('View Code')
|
|
46
|
+
.as('viewCodeBtn');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should show element p with text', () => {
|
|
50
|
+
cy.get('@container')
|
|
51
|
+
.find('p').should('exist');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('has view code button', () => {
|
|
55
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('shows code on click', () => {
|
|
59
|
+
cy.get('@viewCodeBtn').click();
|
|
60
|
+
cy.get('@container')
|
|
61
|
+
.find('textarea')
|
|
62
|
+
.should('exist');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('closes code on click', () => {
|
|
66
|
+
cy.get('@viewCodeBtn').click();
|
|
67
|
+
cy.get('@container')
|
|
68
|
+
.find('textarea')
|
|
69
|
+
.should('not.exist');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|