@@ -22,6 +22,68 @@ import {
2222 contextMenuItems ,
2323} from './test_setup.js' ;
2424
25+ const isDarwin = process . platform === 'darwin' ;
26+ const blockActionsViaKeyboard = [
27+ { 'text' : 'Duplicate D' } ,
28+ { 'text' : 'Add Comment' } ,
29+ { 'text' : 'External Inputs' } ,
30+ { 'text' : 'Collapse Block' } ,
31+ { 'text' : 'Disable Block' } ,
32+ { 'text' : 'Delete 2 Blocks Delete' } ,
33+ { 'text' : 'Move Block M' } ,
34+ { 'text' : 'Edit Block contents Right' } ,
35+ { 'text' : isDarwin ? 'Cut ⌘ X' : 'Cut Ctrl + X' } ,
36+ { 'text' : isDarwin ? 'Copy ⌘ C' : 'Copy Ctrl + C' } ,
37+ { 'disabled' : true , 'text' : isDarwin ? 'Paste ⌘ V' : 'Paste Ctrl + V' } ,
38+ ] ;
39+
40+ const blockActionsViaMouse = [
41+ { 'text' : 'Duplicate D' } ,
42+ { 'text' : 'Add Comment' } ,
43+ { 'text' : 'External Inputs' } ,
44+ { 'text' : 'Collapse Block' } ,
45+ { 'text' : 'Disable Block' } ,
46+ { 'text' : 'Delete 2 Blocks Delete' } ,
47+ { 'text' : isDarwin ? 'Cut ⌘ X' : 'Cut Ctrl + X' } ,
48+ { 'text' : isDarwin ? 'Copy ⌘ C' : 'Copy Ctrl + C' } ,
49+ { 'disabled' : true , 'text' : isDarwin ? 'Paste ⌘ V' : 'Paste Ctrl + V' } ,
50+ ] ;
51+
52+ const shadowBlockActionsViaKeyboard = [
53+ { 'text' : 'Add Comment' } ,
54+ { 'text' : 'Collapse Block' } ,
55+ { 'text' : 'Disable Block' } ,
56+ { 'text' : 'Help' } ,
57+ { 'text' : 'Move Block M' } ,
58+ { 'disabled' : true , 'text' : isDarwin ? 'Cut ⌘ X' : 'Cut Ctrl + X' } ,
59+ { 'text' : isDarwin ? 'Copy ⌘ C' : 'Copy Ctrl + C' } ,
60+ { 'disabled' : true , 'text' : isDarwin ? 'Paste ⌘ V' : 'Paste Ctrl + V' } ,
61+ ] ;
62+
63+ const toolboxBlockActionsViaKeyboard = [
64+ { 'text' : 'Help' } ,
65+ { 'disabled' : true , 'text' : 'Move Block M' } ,
66+ { 'disabled' : true , 'text' : isDarwin ? 'Cut ⌘ X' : 'Cut Ctrl + X' } ,
67+ { 'text' : isDarwin ? 'Copy ⌘ C' : 'Copy Ctrl + C' } ,
68+ ] ;
69+
70+ const flyoutBlockActionsViaMouse = [
71+ { 'text' : 'Help' } ,
72+ { 'disabled' : true , 'text' : isDarwin ? 'Cut ⌘ X' : 'Cut Ctrl + X' } ,
73+ { 'text' : isDarwin ? 'Copy ⌘ C' : 'Copy Ctrl + C' } ,
74+ ] ;
75+
76+ const workspaceActionsViaKeyboard = [
77+ { 'disabled' : true , 'text' : 'Undo' } ,
78+ { 'disabled' : true , 'text' : 'Redo' } ,
79+ { 'text' : 'Clean up Blocks' } ,
80+ { 'text' : 'Collapse Blocks' } ,
81+ { 'disabled' : true , 'text' : 'Expand Blocks' } ,
82+ { 'text' : 'Delete 4 Blocks' } ,
83+ { 'text' : 'Add Comment' } ,
84+ { 'disabled' : true , 'text' : isDarwin ? 'Paste ⌘ V' : 'Paste Ctrl + V' } ,
85+ ] ;
86+
2587suite ( 'Menus test' , function ( ) {
2688 // Disable timeouts when non-zero PAUSE_TIME is used to watch tests run.
2789 if ( PAUSE_TIME ) this . timeout ( 0 ) ;
@@ -45,33 +107,7 @@ suite('Menus test', function () {
45107
46108 chai . assert . deepEqual (
47109 await contextMenuItems ( this . browser ) ,
48- process . platform === 'darwin'
49- ? [
50- { 'text' : 'Duplicate D' } ,
51- { 'text' : 'Add Comment' } ,
52- { 'text' : 'External Inputs' } ,
53- { 'text' : 'Collapse Block' } ,
54- { 'text' : 'Disable Block' } ,
55- { 'text' : 'Delete 2 Blocks Delete' } ,
56- { 'text' : 'Move Block M' } ,
57- { 'text' : 'Edit Block contents Right' } ,
58- { 'text' : 'Cut ⌘ X' } ,
59- { 'text' : 'Copy ⌘ C' } ,
60- { 'disabled' : true , 'text' : 'Paste ⌘ V' } ,
61- ]
62- : [
63- { 'text' : 'Duplicate D' } ,
64- { 'text' : 'Add Comment' } ,
65- { 'text' : 'External Inputs' } ,
66- { 'text' : 'Collapse Block' } ,
67- { 'text' : 'Disable Block' } ,
68- { 'text' : 'Delete 2 Blocks Delete' } ,
69- { 'text' : 'Move Block M' } ,
70- { 'text' : 'Edit Block contents Right' } ,
71- { 'text' : 'Cut Ctrl + X' } ,
72- { 'text' : 'Copy Ctrl + C' } ,
73- { 'disabled' : true , 'text' : 'Paste Ctrl + V' } ,
74- ] ,
110+ blockActionsViaKeyboard ,
75111 ) ;
76112 } ) ;
77113
@@ -81,29 +117,7 @@ suite('Menus test', function () {
81117
82118 chai . assert . deepEqual (
83119 await contextMenuItems ( this . browser ) ,
84- process . platform === 'darwin'
85- ? [
86- { 'text' : 'Duplicate D' } ,
87- { 'text' : 'Add Comment' } ,
88- { 'text' : 'External Inputs' } ,
89- { 'text' : 'Collapse Block' } ,
90- { 'text' : 'Disable Block' } ,
91- { 'text' : 'Delete 2 Blocks Delete' } ,
92- { 'text' : 'Cut ⌘ X' } ,
93- { 'text' : 'Copy ⌘ C' } ,
94- { 'disabled' : true , 'text' : 'Paste ⌘ V' } ,
95- ]
96- : [
97- { 'text' : 'Duplicate D' } ,
98- { 'text' : 'Add Comment' } ,
99- { 'text' : 'External Inputs' } ,
100- { 'text' : 'Collapse Block' } ,
101- { 'text' : 'Disable Block' } ,
102- { 'text' : 'Delete 2 Blocks Delete' } ,
103- { 'text' : 'Cut Ctrl + X' } ,
104- { 'text' : 'Copy Ctrl + C' } ,
105- { 'disabled' : true , 'text' : 'Paste Ctrl + V' } ,
106- ] ,
120+ blockActionsViaMouse ,
107121 ) ;
108122 } ) ;
109123
@@ -115,27 +129,7 @@ suite('Menus test', function () {
115129
116130 chai . assert . deepEqual (
117131 await contextMenuItems ( this . browser ) ,
118- process . platform === 'darwin'
119- ? [
120- { 'text' : 'Add Comment' } ,
121- { 'text' : 'Collapse Block' } ,
122- { 'text' : 'Disable Block' } ,
123- { 'text' : 'Help' } ,
124- { 'text' : 'Move Block M' } ,
125- { 'disabled' : true , 'text' : 'Cut ⌘ X' } ,
126- { 'text' : 'Copy ⌘ C' } ,
127- { 'disabled' : true , 'text' : 'Paste ⌘ V' } ,
128- ]
129- : [
130- { 'text' : 'Add Comment' } ,
131- { 'text' : 'Collapse Block' } ,
132- { 'text' : 'Disable Block' } ,
133- { 'text' : 'Help' } ,
134- { 'text' : 'Move Block M' } ,
135- { 'disabled' : true , 'text' : 'Cut Ctrl + X' } ,
136- { 'text' : 'Copy Ctrl + C' } ,
137- { 'disabled' : true , 'text' : 'Paste Ctrl + V' } ,
138- ] ,
132+ shadowBlockActionsViaKeyboard ,
139133 ) ;
140134 } ) ;
141135
@@ -148,20 +142,8 @@ suite('Menus test', function () {
148142 await sendKeyAndWait ( this . browser , [ Key . Ctrl , Key . Return ] ) ;
149143
150144 chai . assert . deepEqual (
151- process . platform === 'darwin'
152- ? [
153- { 'text' : 'Help' } ,
154- { 'disabled' : true , 'text' : 'Move Block M' } ,
155- { 'disabled' : true , 'text' : 'Cut ⌘ X' } ,
156- { 'text' : 'Copy ⌘ C' } ,
157- ]
158- : [
159- { 'text' : 'Help' } ,
160- { 'disabled' : true , 'text' : 'Move Block M' } ,
161- { 'disabled' : true , 'text' : 'Cut Ctrl + X' } ,
162- { 'text' : 'Copy Ctrl + C' } ,
163- ] ,
164145 await contextMenuItems ( this . browser ) ,
146+ toolboxBlockActionsViaKeyboard ,
165147 ) ;
166148 } ) ;
167149
@@ -176,18 +158,8 @@ suite('Menus test', function () {
176158 await this . browser . pause ( PAUSE_TIME ) ;
177159
178160 chai . assert . deepEqual (
179- process . platform === 'darwin'
180- ? [
181- { 'text' : 'Help' } ,
182- { 'disabled' : true , 'text' : 'Cut ⌘ X' } ,
183- { 'text' : 'Copy ⌘ C' } ,
184- ]
185- : [
186- { 'text' : 'Help' } ,
187- { 'disabled' : true , 'text' : 'Cut Ctrl + X' } ,
188- { 'text' : 'Copy Ctrl + C' } ,
189- ] ,
190161 await contextMenuItems ( this . browser ) ,
162+ flyoutBlockActionsViaMouse ,
191163 ) ;
192164 } ) ;
193165
@@ -198,28 +170,8 @@ suite('Menus test', function () {
198170 await sendKeyAndWait ( this . browser , [ Key . Ctrl , Key . Return ] ) ;
199171
200172 chai . assert . deepEqual (
201- process . platform === 'darwin'
202- ? [
203- { 'disabled' : true , 'text' : 'Undo' } ,
204- { 'disabled' : true , 'text' : 'Redo' } ,
205- { 'text' : 'Clean up Blocks' } ,
206- { 'text' : 'Collapse Blocks' } ,
207- { 'disabled' : true , 'text' : 'Expand Blocks' } ,
208- { 'text' : 'Delete 4 Blocks' } ,
209- { 'text' : 'Add Comment' } ,
210- { 'disabled' : true , 'text' : 'Paste ⌘ V' } ,
211- ]
212- : [
213- { 'disabled' : true , 'text' : 'Undo' } ,
214- { 'disabled' : true , 'text' : 'Redo' } ,
215- { 'text' : 'Clean up Blocks' } ,
216- { 'text' : 'Collapse Blocks' } ,
217- { 'disabled' : true , 'text' : 'Expand Blocks' } ,
218- { 'text' : 'Delete 4 Blocks' } ,
219- { 'text' : 'Add Comment' } ,
220- { 'disabled' : true , 'text' : 'Paste Ctrl + V' } ,
221- ] ,
222173 await contextMenuItems ( this . browser ) ,
174+ workspaceActionsViaKeyboard ,
223175 ) ;
224176 } ) ;
225177
0 commit comments