OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 GEN_INCLUDE(['../../testing/assert_additions.js']); | 5 GEN_INCLUDE(['../../testing/assert_additions.js']); |
6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); | 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); |
7 | 7 |
8 /** | 8 /** |
9 * Gets the braille output and asserts that it matches expected values. | 9 * Gets the braille output and asserts that it matches expected values. |
10 * Annotations in the output that are primitive strings are ignored. | 10 * Annotations in the output that are primitive strings are ignored. |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 {value: new Output.EarconAction("BUTTON"), start: 0, end: 11}, | 293 {value: new Output.EarconAction("BUTTON"), start: 0, end: 11}, |
294 {value: 'value', start: 12, end: 26}, | 294 {value: 'value', start: 12, end: 26}, |
295 {value: 'role', start: 27, end: 33}] | 295 {value: 'role', start: 27, end: 33}] |
296 ], | 296 ], |
297 '||Edit text, search entry', | 297 '||Edit text, search entry', |
298 '||Edit text' | 298 '||Edit text' |
299 ]; | 299 ]; |
300 // TODO(plundblad): Some of these are wrong, there should be an initial | 300 // TODO(plundblad): Some of these are wrong, there should be an initial |
301 // space for the cursor in edit fields. | 301 // space for the cursor in edit fields. |
302 var expectedBrailleValues = [ | 302 var expectedBrailleValues = [ |
303 'ed', | 303 ' ed', |
304 '@ed', | 304 ' @ed', |
305 'pwded', | 305 ' pwded', |
306 '#ed', | 306 ' #ed', |
307 'spnbtn', | 307 ' spnbtn', |
308 {string_: 'time'}, | 308 {string_: 'time'}, |
309 {string_: 'date'}, | 309 {string_: 'date'}, |
310 {string_: 'Choose File No file chosen btn'}, | 310 {string_: 'Choose File No file chosen btn'}, |
311 'srched', | 311 ' srched', |
312 'ed' | 312 ' ed' |
313 ]; | 313 ]; |
314 assertEquals(expectedSpeechValues.length, expectedBrailleValues.length); | 314 assertEquals(expectedSpeechValues.length, expectedBrailleValues.length); |
315 | 315 |
316 var el = root.firstChild.firstChild; | 316 var el = root.firstChild.firstChild; |
317 expectedSpeechValues.forEach(function(expectedValue) { | 317 expectedSpeechValues.forEach(function(expectedValue) { |
318 var range = cursors.Range.fromNode(el); | 318 var range = cursors.Range.fromNode(el); |
319 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); | 319 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
320 if (typeof expectedValue == 'object') { | 320 if (typeof expectedValue == 'object') { |
321 checkSpeechOutput(expectedValue[0], expectedValue[1], o); | 321 checkSpeechOutput(expectedValue[0], expectedValue[1], o); |
322 } else { | 322 } else { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 checkSpeechOutput( | 389 checkSpeechOutput( |
390 'a|Tree item|Expanded| 1 of 3 | level 1 |Tree|with 3 items', | 390 'a|Tree item|Expanded| 1 of 3 | level 1 |Tree|with 3 items', |
391 [ | 391 [ |
392 {value: 'name', 'start': 0, end: 1}, | 392 {value: 'name', 'start': 0, end: 1}, |
393 {value: 'state', start: 12, end: 20}, | 393 {value: 'state', start: 12, end: 20}, |
394 {value: 'role','start': 40, end: 44}, | 394 {value: 'role','start': 40, end: 44}, |
395 ], | 395 ], |
396 o); | 396 o); |
397 // TODO(plundblad): Braille output is wrong. | 397 // TODO(plundblad): Braille output is wrong. |
398 checkBrailleOutput( | 398 checkBrailleOutput( |
399 'a tritm - 1/3 level 1 tree +3', | 399 'a tritm - 1/3 level 1 tree +3', |
400 [{value: new Output.NodeSpan(el), start: 0, end: 1}, | 400 [{value: new Output.NodeSpan(el), start: 0, end: 1}, |
401 {value: new Output.NodeSpan(el.parent), start: 2, end: 23}, | 401 {value: new Output.NodeSpan(el.parent), start: 2, end: 23}, |
402 {value: new Output.NodeSpan(el.parent.parent), start: 23, end: 30}], | 402 {value: new Output.NodeSpan(el.parent.parent), start: 24, end: 31}], |
403 o); | 403 o); |
404 | 404 |
405 el = root.firstChild.children[1].firstChild; | 405 el = root.firstChild.children[1].firstChild; |
406 range = cursors.Range.fromNode(el); | 406 range = cursors.Range.fromNode(el); |
407 o = new Output().withSpeechAndBraille(range, null, 'navigate'); | 407 o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
408 checkSpeechOutput( | 408 checkSpeechOutput( |
409 'b|Tree item| 2 of 3 | level 1 |Tree|with 3 items', | 409 'b|Tree item| 2 of 3 | level 1 |Tree|with 3 items', |
410 [ | 410 [ |
411 {value: 'name', start: 0, end: 1}, | 411 {value: 'name', start: 0, end: 1}, |
412 {value: 'role', 'start': 31, end: 35} | 412 {value: 'role', 'start': 31, end: 35} |
413 ], | 413 ], |
414 o); | 414 o); |
415 // TODO(plundblad): Braille output is wrong. | 415 // TODO(plundblad): Braille output is wrong. |
416 checkBrailleOutput( | 416 checkBrailleOutput( |
417 'b tritm 2/3 level 1 tree +3', | 417 'b tritm 2/3 level 1 tree +3', |
418 [{value: new Output.NodeSpan(el), start: 0, end: 1}, | 418 [{value: new Output.NodeSpan(el), start: 0, end: 1}, |
419 {value: new Output.NodeSpan(el.parent), start: 2, end: 21}, | 419 {value: new Output.NodeSpan(el.parent), start: 2, end: 21}, |
420 {value: new Output.NodeSpan(el.parent.parent), start: 21, end: 28}], | 420 {value: new Output.NodeSpan(el.parent.parent), start: 22, end: 29}], |
421 o); | 421 o); |
422 | 422 |
423 el = root.firstChild.children[2].firstChild; | 423 el = root.firstChild.children[2].firstChild; |
424 range = cursors.Range.fromNode(el); | 424 range = cursors.Range.fromNode(el); |
425 o = new Output().withSpeechAndBraille(range, null, 'navigate'); | 425 o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
426 checkSpeechOutput( | 426 checkSpeechOutput( |
427 'c|Tree item|Collapsed| 3 of 3 | level 1 |Tree|with 3 items', | 427 'c|Tree item|Collapsed| 3 of 3 | level 1 |Tree|with 3 items', |
428 [ | 428 [ |
429 {value: 'name', 'start': 0, end: 1}, | 429 {value: 'name', 'start': 0, end: 1}, |
430 {value: 'state', start: 12, end: 21}, | 430 {value: 'state', start: 12, end: 21}, |
431 {value: 'role','start': 41, end: 45}, | 431 {value: 'role','start': 41, end: 45}, |
432 ], | 432 ], |
433 o); | 433 o); |
434 // TODO(plundblad): Braille output is wrong. | 434 // TODO(plundblad): Braille output is wrong. |
435 checkBrailleOutput( | 435 checkBrailleOutput( |
436 'c tritm + 3/3 level 1 tree +3', | 436 'c tritm + 3/3 level 1 tree +3', |
437 [{value: new Output.NodeSpan(el), start: 0, end: 1}, | 437 [{value: new Output.NodeSpan(el), start: 0, end: 1}, |
438 {value: new Output.NodeSpan(el.parent), start: 2, end: 23}, | 438 {value: new Output.NodeSpan(el.parent), start: 2, end: 23}, |
439 {value: new Output.NodeSpan(el.parent.parent), start: 23, end: 30}], | 439 {value: new Output.NodeSpan(el.parent.parent), start: 24, end: 31}], |
440 o); | 440 o); |
441 }); | 441 }); |
442 }); | 442 }); |
443 | 443 |
444 TEST_F('OutputE2ETest', 'Menu', function() { | 444 TEST_F('OutputE2ETest', 'Menu', function() { |
445 this.runWithLoadedTree(function() {/*! | 445 this.runWithLoadedTree(function() {/*! |
446 <div role="menu"> | 446 <div role="menu"> |
447 <div role="menuitem">a</div> | 447 <div role="menuitem">a</div> |
448 </div> | 448 </div> |
449 */}, | 449 */}, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 this.runWithLoadedTree(function() {/*! | 643 this.runWithLoadedTree(function() {/*! |
644 <div><button>ok</button></div> | 644 <div><button>ok</button></div> |
645 */}, | 645 */}, |
646 function(root) { | 646 function(root) { |
647 var div = root.find({role: 'div'}); | 647 var div = root.find({role: 'div'}); |
648 var o = new Output().withSpeech(cursors.Range.fromNode(div)); | 648 var o = new Output().withSpeech(cursors.Range.fromNode(div)); |
649 assertEquals('ok|Button' | 649 assertEquals('ok|Button' |
650 , o.speechOutputForTest.string_); | 650 , o.speechOutputForTest.string_); |
651 }); | 651 }); |
652 }); | 652 }); |
OLD | NEW |