@@ -8,8 +8,8 @@ import * as chai from 'chai';
88import * as Blockly from 'blockly' ;
99import {
1010 isDragging ,
11- setCurrentCursorNodeById ,
12- setCurrentCursorNodeByIdAndFieldName ,
11+ focusOnBlock ,
12+ focusOnBlockField ,
1313 getCurrentFocusNodeId ,
1414 getCurrentFocusedBlockId ,
1515 getFocusedFieldName ,
@@ -53,7 +53,7 @@ suite('Keyboard navigation on Blocks', function () {
5353 test ( 'Down from statement block selects next block across stacks' , async function ( ) {
5454 await tabNavigateToWorkspace ( this . browser ) ;
5555 await this . browser . pause ( PAUSE_TIME ) ;
56- await setCurrentCursorNodeById ( this . browser , 'p5_canvas_1' ) ;
56+ await focusOnBlock ( this . browser , 'p5_canvas_1' ) ;
5757 await this . browser . pause ( PAUSE_TIME ) ;
5858 await this . browser . keys ( Key . ArrowDown ) ;
5959 await this . browser . pause ( PAUSE_TIME ) ;
@@ -66,7 +66,7 @@ suite('Keyboard navigation on Blocks', function () {
6666 test ( 'Up from statement block selects previous block' , async function ( ) {
6767 await tabNavigateToWorkspace ( this . browser ) ;
6868 await this . browser . pause ( PAUSE_TIME ) ;
69- await setCurrentCursorNodeById ( this . browser , 'simple_circle_1' ) ;
69+ await focusOnBlock ( this . browser , 'simple_circle_1' ) ;
7070 await this . browser . pause ( PAUSE_TIME ) ;
7171 await this . browser . keys ( Key . ArrowUp ) ;
7272 await this . browser . pause ( PAUSE_TIME ) ;
@@ -79,7 +79,7 @@ suite('Keyboard navigation on Blocks', function () {
7979 test ( 'Down from parent block selects first child block' , async function ( ) {
8080 await tabNavigateToWorkspace ( this . browser ) ;
8181 await this . browser . pause ( PAUSE_TIME ) ;
82- await setCurrentCursorNodeById ( this . browser , 'p5_setup_1' ) ;
82+ await focusOnBlock ( this . browser , 'p5_setup_1' ) ;
8383 await this . browser . pause ( PAUSE_TIME ) ;
8484 await this . browser . keys ( Key . ArrowDown ) ;
8585 await this . browser . pause ( PAUSE_TIME ) ;
@@ -91,7 +91,7 @@ suite('Keyboard navigation on Blocks', function () {
9191 test ( 'Up from child block selects parent block' , async function ( ) {
9292 await tabNavigateToWorkspace ( this . browser ) ;
9393 await this . browser . pause ( PAUSE_TIME ) ;
94- await setCurrentCursorNodeById ( this . browser , 'p5_canvas_1' ) ;
94+ await focusOnBlock ( this . browser , 'p5_canvas_1' ) ;
9595 await this . browser . pause ( PAUSE_TIME ) ;
9696 await this . browser . keys ( Key . ArrowUp ) ;
9797 await this . browser . pause ( PAUSE_TIME ) ;
@@ -103,7 +103,7 @@ suite('Keyboard navigation on Blocks', function () {
103103 test ( 'Right from block selects first field' , async function ( ) {
104104 await tabNavigateToWorkspace ( this . browser ) ;
105105 await this . browser . pause ( PAUSE_TIME ) ;
106- await setCurrentCursorNodeById ( this . browser , 'p5_canvas_1' ) ;
106+ await focusOnBlock ( this . browser , 'p5_canvas_1' ) ;
107107 await this . browser . pause ( PAUSE_TIME ) ;
108108 await this . browser . keys ( Key . ArrowRight ) ;
109109 await this . browser . pause ( PAUSE_TIME ) ;
@@ -118,7 +118,7 @@ suite('Keyboard navigation on Blocks', function () {
118118 test ( 'Right from block selects first inline input' , async function ( ) {
119119 await tabNavigateToWorkspace ( this . browser ) ;
120120 await this . browser . pause ( PAUSE_TIME ) ;
121- await setCurrentCursorNodeById ( this . browser , 'simple_circle_1' ) ;
121+ await focusOnBlock ( this . browser , 'simple_circle_1' ) ;
122122 await this . browser . pause ( PAUSE_TIME ) ;
123123 await this . browser . keys ( Key . ArrowRight ) ;
124124 await this . browser . pause ( PAUSE_TIME ) ;
@@ -132,7 +132,7 @@ suite('Keyboard navigation on Blocks', function () {
132132 test ( 'Up from inline input selects statement block' , async function ( ) {
133133 await tabNavigateToWorkspace ( this . browser ) ;
134134 await this . browser . pause ( PAUSE_TIME ) ;
135- await setCurrentCursorNodeById ( this . browser , 'math_number_2' ) ;
135+ await focusOnBlock ( this . browser , 'math_number_2' ) ;
136136 await this . browser . pause ( PAUSE_TIME ) ;
137137 await this . browser . keys ( Key . ArrowUp ) ;
138138 await this . browser . pause ( PAUSE_TIME ) ;
@@ -146,7 +146,7 @@ suite('Keyboard navigation on Blocks', function () {
146146 test ( 'Left from first inline input selects block' , async function ( ) {
147147 await tabNavigateToWorkspace ( this . browser ) ;
148148 await this . browser . pause ( PAUSE_TIME ) ;
149- await setCurrentCursorNodeById ( this . browser , 'math_number_2' ) ;
149+ await focusOnBlock ( this . browser , 'math_number_2' ) ;
150150 await this . browser . pause ( PAUSE_TIME ) ;
151151 await this . browser . keys ( Key . ArrowLeft ) ;
152152 await this . browser . pause ( PAUSE_TIME ) ;
@@ -160,7 +160,7 @@ suite('Keyboard navigation on Blocks', function () {
160160 test ( 'Right from first inline input selects second inline input' , async function ( ) {
161161 await tabNavigateToWorkspace ( this . browser ) ;
162162 await this . browser . pause ( PAUSE_TIME ) ;
163- await setCurrentCursorNodeById ( this . browser , 'math_number_2' ) ;
163+ await focusOnBlock ( this . browser , 'math_number_2' ) ;
164164 await this . browser . pause ( PAUSE_TIME ) ;
165165 await this . browser . keys ( Key . ArrowRight ) ;
166166 await this . browser . pause ( PAUSE_TIME ) ;
@@ -174,7 +174,7 @@ suite('Keyboard navigation on Blocks', function () {
174174 test ( 'Left from second inline input selects first inline input' , async function ( ) {
175175 await tabNavigateToWorkspace ( this . browser ) ;
176176 await this . browser . pause ( PAUSE_TIME ) ;
177- await setCurrentCursorNodeById ( this . browser , 'math_number_3' ) ;
177+ await focusOnBlock ( this . browser , 'math_number_3' ) ;
178178 await this . browser . pause ( PAUSE_TIME ) ;
179179 await this . browser . keys ( Key . ArrowLeft ) ;
180180 await this . browser . pause ( PAUSE_TIME ) ;
@@ -188,7 +188,7 @@ suite('Keyboard navigation on Blocks', function () {
188188 test ( 'Right from last inline input selects next block' , async function ( ) {
189189 await tabNavigateToWorkspace ( this . browser ) ;
190190 await this . browser . pause ( PAUSE_TIME ) ;
191- await setCurrentCursorNodeById ( this . browser , 'colour_picker_1' ) ;
191+ await focusOnBlock ( this . browser , 'colour_picker_1' ) ;
192192 await this . browser . pause ( PAUSE_TIME ) ;
193193 await this . browser . keys ( Key . ArrowRight ) ;
194194 await this . browser . pause ( PAUSE_TIME ) ;
@@ -201,7 +201,7 @@ suite('Keyboard navigation on Blocks', function () {
201201 test ( 'Down from inline input selects next block' , async function ( ) {
202202 await tabNavigateToWorkspace ( this . browser ) ;
203203 await this . browser . pause ( PAUSE_TIME ) ;
204- await setCurrentCursorNodeById ( this . browser , 'colour_picker_1' ) ;
204+ await focusOnBlock ( this . browser , 'colour_picker_1' ) ;
205205 await this . browser . pause ( PAUSE_TIME ) ;
206206 await this . browser . keys ( Key . ArrowDown ) ;
207207 await this . browser . pause ( PAUSE_TIME ) ;
@@ -214,7 +214,7 @@ suite('Keyboard navigation on Blocks', function () {
214214 test ( "Down from inline input selects block's child block" , async function ( ) {
215215 await tabNavigateToWorkspace ( this . browser ) ;
216216 await this . browser . pause ( PAUSE_TIME ) ;
217- await setCurrentCursorNodeById ( this . browser , 'logic_boolean_1' ) ;
217+ await focusOnBlock ( this . browser , 'logic_boolean_1' ) ;
218218 await this . browser . pause ( PAUSE_TIME ) ;
219219 await this . browser . keys ( Key . ArrowDown ) ;
220220 await this . browser . pause ( PAUSE_TIME ) ;
@@ -227,7 +227,7 @@ suite('Keyboard navigation on Blocks', function () {
227227 test ( 'Right from text block selects shadow block then field' , async function ( ) {
228228 await tabNavigateToWorkspace ( this . browser ) ;
229229 await this . browser . pause ( PAUSE_TIME ) ;
230- await setCurrentCursorNodeById ( this . browser , 'text_print_1' ) ;
230+ await focusOnBlock ( this . browser , 'text_print_1' ) ;
231231 await this . browser . pause ( PAUSE_TIME ) ;
232232 await this . browser . keys ( Key . ArrowRight ) ;
233233 await this . browser . pause ( PAUSE_TIME ) ;
@@ -252,7 +252,7 @@ suite('Keyboard navigation on Blocks', function () {
252252 test ( 'Losing focus cancels move' , async function ( ) {
253253 await tabNavigateToWorkspace ( this . browser ) ;
254254 await this . browser . pause ( PAUSE_TIME ) ;
255- await setCurrentCursorNodeById ( this . browser , 'text_print_1' ) ;
255+ await focusOnBlock ( this . browser , 'text_print_1' ) ;
256256 await this . browser . keys ( 'm' ) ;
257257 await this . browser . pause ( PAUSE_TIME ) ;
258258
@@ -265,7 +265,6 @@ suite('Keyboard navigation on Blocks', function () {
265265 } ) ;
266266} ) ;
267267
268- // TODO(#499) These tests fail because focusing on a field doesn't update the cursor
269268suite ( 'Keyboard navigation on Fields' , function ( ) {
270269 // Setting timeout to unlimited as these tests take a longer time to run than most mocha test
271270 this . timeout ( 0 ) ;
@@ -278,7 +277,7 @@ suite('Keyboard navigation on Fields', function () {
278277 test ( 'Up from first field selects block' , async function ( ) {
279278 await tabNavigateToWorkspace ( this . browser ) ;
280279 await this . browser . pause ( PAUSE_TIME ) ;
281- await setCurrentCursorNodeByIdAndFieldName (
280+ await focusOnBlockField (
282281 this . browser ,
283282 'p5_canvas_1' ,
284283 'WIDTH' ,
@@ -296,7 +295,7 @@ suite('Keyboard navigation on Fields', function () {
296295 test ( 'Left from first field selects block' , async function ( ) {
297296 await tabNavigateToWorkspace ( this . browser ) ;
298297 await this . browser . pause ( PAUSE_TIME ) ;
299- await setCurrentCursorNodeByIdAndFieldName (
298+ await focusOnBlockField (
300299 this . browser ,
301300 'p5_canvas_1' ,
302301 'WIDTH' ,
@@ -314,7 +313,7 @@ suite('Keyboard navigation on Fields', function () {
314313 test ( 'Right from first field selects second field' , async function ( ) {
315314 await tabNavigateToWorkspace ( this . browser ) ;
316315 await this . browser . pause ( PAUSE_TIME ) ;
317- await setCurrentCursorNodeByIdAndFieldName (
316+ await focusOnBlockField (
318317 this . browser ,
319318 'p5_canvas_1' ,
320319 'WIDTH' ,
@@ -333,7 +332,7 @@ suite('Keyboard navigation on Fields', function () {
333332 test ( 'Left from second field selects first field' , async function ( ) {
334333 await tabNavigateToWorkspace ( this . browser ) ;
335334 await this . browser . pause ( PAUSE_TIME ) ;
336- await setCurrentCursorNodeByIdAndFieldName (
335+ await focusOnBlockField (
337336 this . browser ,
338337 'p5_canvas_1' ,
339338 'HEIGHT' ,
@@ -352,7 +351,7 @@ suite('Keyboard navigation on Fields', function () {
352351 test ( 'Right from second field selects next block' , async function ( ) {
353352 await tabNavigateToWorkspace ( this . browser ) ;
354353 await this . browser . pause ( PAUSE_TIME ) ;
355- await setCurrentCursorNodeByIdAndFieldName (
354+ await focusOnBlockField (
356355 this . browser ,
357356 'p5_canvas_1' ,
358357 'HEIGHT' ,
@@ -369,7 +368,7 @@ suite('Keyboard navigation on Fields', function () {
369368 test ( 'Down from field selects next block' , async function ( ) {
370369 await tabNavigateToWorkspace ( this . browser ) ;
371370 await this . browser . pause ( PAUSE_TIME ) ;
372- await setCurrentCursorNodeByIdAndFieldName (
371+ await focusOnBlockField (
373372 this . browser ,
374373 'p5_canvas_1' ,
375374 'WIDTH' ,
@@ -386,7 +385,7 @@ suite('Keyboard navigation on Fields', function () {
386385 test ( "Down from field selects block's child block" , async function ( ) {
387386 await tabNavigateToWorkspace ( this . browser ) ;
388387 await this . browser . pause ( PAUSE_TIME ) ;
389- await setCurrentCursorNodeByIdAndFieldName (
388+ await focusOnBlockField (
390389 this . browser ,
391390 'controls_repeat_1' ,
392391 'TIMES' ,
0 commit comments