Skip to content

Commit 30439c6

Browse files
Merge branch 'login-logout-flicker' of github.com:kitconcept/volto-light-theme into login-logout-flicker
2 parents 4fbb890 + 2157bc8 commit 30439c6

File tree

3 files changed

+247
-0
lines changed

3 files changed

+247
-0
lines changed
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
describe('Enter key behavior on focused blocks', () => {
2+
const addBlockAndPressEnter = ({
3+
chooserClass,
4+
label,
5+
chooserSection = 'mostUsed',
6+
selectedSelectors,
7+
}) => {
8+
// Open block chooser and pick the block
9+
cy.get('.button .block-add-button').click({ force: true });
10+
11+
cy.get(`.blocks-chooser .${chooserSection} .button.${chooserClass}`)
12+
.contains(label)
13+
.click({ force: true });
14+
15+
cy.wait(500);
16+
// press enter
17+
cy.focused().type('{enter}');
18+
// Now we can see two slate editor
19+
cy.get('.block-editor-slate').should('have.length', 2);
20+
};
21+
22+
beforeEach(() => {
23+
cy.intercept('GET', `/**/*?expand*`).as('content');
24+
cy.intercept('GET', '/**/Document').as('schema');
25+
26+
cy.autologin();
27+
cy.createContent({
28+
contentType: 'Document',
29+
contentId: 'my-page',
30+
contentTitle: 'My Page',
31+
});
32+
33+
cy.visit('/my-page');
34+
cy.wait('@content');
35+
36+
cy.navigate('/my-page/edit');
37+
cy.wait('@schema');
38+
});
39+
40+
it('Pressing Enter on a focused Button block opens Slate editor or block chooser', () => {
41+
addBlockAndPressEnter({
42+
chooserClass: 'button',
43+
label: 'Button',
44+
});
45+
});
46+
47+
it('Pressing Enter on a focused Heading block opens Slate editor or block chooser', () => {
48+
addBlockAndPressEnter({
49+
chooserClass: 'heading',
50+
label: 'Heading',
51+
});
52+
});
53+
54+
it('Pressing Enter on a focused Image block opens Slate editor or block chooser', () => {
55+
addBlockAndPressEnter({
56+
chooserClass: 'image',
57+
label: 'Image',
58+
});
59+
});
60+
61+
it('Pressing Enter on a focused Grid block opens Slate editor or block chooser', () => {
62+
addBlockAndPressEnter({
63+
chooserClass: 'gridBlock',
64+
label: 'Grid',
65+
});
66+
});
67+
68+
it('Pressing Enter on a focused Social Media block opens Slate editor or block chooser', () => {
69+
addBlockAndPressEnter({
70+
chooserClass: 'followUsBlock',
71+
label: 'Follow Us Block',
72+
chooserSection: 'common',
73+
});
74+
});
75+
76+
it('Pressing Enter on a focused Calendar block opens Slate editor or block chooser', () => {
77+
addBlockAndPressEnter({
78+
chooserClass: 'eventCalendar',
79+
label: 'Calendar',
80+
chooserSection: 'common',
81+
});
82+
});
83+
84+
it('Pressing Enter on a focused Listing block opens Slate editor or block chooser', () => {
85+
addBlockAndPressEnter({
86+
chooserClass: 'listing',
87+
label: 'Listing',
88+
});
89+
});
90+
91+
it('Pressing Enter on a focused Maps block opens Slate editor or block chooser', () => {
92+
addBlockAndPressEnter({
93+
chooserClass: 'maps',
94+
label: 'Maps',
95+
chooserSection: 'common',
96+
});
97+
});
98+
99+
it('Pressing Enter on a focused Search block opens Slate editor or block chooser', () => {
100+
addBlockAndPressEnter({
101+
chooserClass: 'search',
102+
label: 'Search',
103+
chooserSection: 'common',
104+
});
105+
});
106+
107+
it('Pressing Enter on a focused Separator block opens Slate editor or block chooser', () => {
108+
addBlockAndPressEnter({
109+
chooserClass: 'separator',
110+
label: 'Separator',
111+
});
112+
});
113+
114+
it('Pressing Enter on a focused Teaser block opens Slate editor or block chooser', () => {
115+
addBlockAndPressEnter({
116+
chooserClass: 'teaser',
117+
label: 'Teaser',
118+
});
119+
});
120+
121+
it('Pressing Enter on a focused Table of Contents block opens Slate editor or block chooser', () => {
122+
addBlockAndPressEnter({
123+
chooserClass: 'toc',
124+
label: 'Table of Contents',
125+
chooserSection: 'common',
126+
});
127+
});
128+
129+
it('Pressing Enter on a focused Carousel block opens Slate editor or block chooser', () => {
130+
addBlockAndPressEnter({
131+
chooserClass: 'carousel',
132+
label: 'Carousel',
133+
});
134+
});
135+
136+
it('Pressing Enter on a focused Logos block opens Slate editor or block chooser', () => {
137+
addBlockAndPressEnter({
138+
chooserClass: 'logos',
139+
label: 'Logos',
140+
});
141+
});
142+
143+
it('Pressing Enter on a focused Slider block opens Slate editor or block chooser', () => {
144+
addBlockAndPressEnter({
145+
chooserClass: 'slider',
146+
label: 'Slider',
147+
chooserSection: 'common',
148+
});
149+
});
150+
151+
it('Pressing Enter on a focused Banner block opens Slate editor or block chooser', () => {
152+
addBlockAndPressEnter({
153+
chooserClass: 'banner',
154+
label: 'Banner',
155+
chooserSection: 'common',
156+
});
157+
});
158+
159+
it('Pressing Enter on a focused Description block opens Slate editor or block chooser', () => {
160+
addBlockAndPressEnter({
161+
chooserClass: 'description',
162+
label: 'Description',
163+
chooserSection: 'text',
164+
});
165+
});
166+
167+
it('Pressing Enter on a focused Video block opens Slate editor or block chooser', () => {
168+
addBlockAndPressEnter({
169+
chooserClass: 'video',
170+
label: 'Video',
171+
});
172+
});
173+
});
174+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
describe('Blocks Enter Key Tests - Special Cases', () => {
2+
beforeEach(() => {
3+
cy.intercept('GET', `/**/*?expand*`).as('content');
4+
cy.intercept('GET', '/**/Document').as('schema');
5+
6+
cy.autologin();
7+
cy.createContent({
8+
contentType: 'Document',
9+
contentId: 'my-page',
10+
contentTitle: 'My Page',
11+
});
12+
13+
cy.visit('/my-page');
14+
cy.wait('@content');
15+
16+
cy.navigate('/my-page/edit');
17+
cy.wait('@schema');
18+
});
19+
20+
it('Pressing Enter on a focused HTML block opens Slate editor or block chooser', () => {
21+
// Add HTML block
22+
cy.get('.button .block-add-button').click({ force: true });
23+
cy.get('.blocks-chooser .common .button.html')
24+
.contains('HTML')
25+
.click({ force: true });
26+
cy.wait(500);
27+
28+
cy.focused().type('{enter}');
29+
// Now we can see two slate editor
30+
cy.get('.block-editor-slate').should('have.length', 2);
31+
});
32+
33+
it('Pressing Enter on a focused Text block opens Slate editor or block chooser', () => {
34+
// Add Text block
35+
cy.get('.button .block-add-button').click({ force: true });
36+
cy.get('.blocks-chooser .title').contains('Text').click({ force: true });
37+
cy.get('.blocks-chooser .button.slate')
38+
.contains('Text')
39+
.click({ force: true });
40+
cy.wait(500);
41+
42+
cy.focused().type('{enter}');
43+
// Now we can see three slate editor
44+
cy.get('.block-editor-slate').should('have.length', 3);
45+
});
46+
47+
it('Pressing Enter on a focused Introduction block opens Slate editor or block chooser', () => {
48+
// Add Introduction block
49+
cy.get('.button .block-add-button').click({ force: true });
50+
cy.get('.blocks-chooser .mostUsed .button.introduction')
51+
.contains('Introduction')
52+
.click({ force: true });
53+
cy.wait(500);
54+
55+
cy.focused().type('{enter}');
56+
// Now we can see two slate editor
57+
cy.get('.block-editor-slate').should('have.length', 2);
58+
});
59+
60+
it('Pressing Enter on a focused Highlight block opens Slate editor or block chooser', () => {
61+
// Add Highlight block
62+
cy.get('.button .block-add-button').click({ force: true });
63+
cy.get('.blocks-chooser .mostUsed .button.highlight')
64+
.contains('Highlight')
65+
.click({ force: true });
66+
cy.wait(500);
67+
68+
cy.focused().type('{enter}');
69+
// Now we can see two slate editor
70+
cy.get('.block-editor-slate').should('have.length', 2);
71+
});
72+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add Cypress tests for Enter key behavior on focused blocks @iRohitSingh

0 commit comments

Comments
 (0)