How to use findNext method in redwood

Best JavaScript code snippet using redwood

command_store.js

Source:command_store.js Github

copy

Full Screen

1// Copyright 2014 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4/**5 * @fileoverview This class acts as the persistent store for all static data6 * about commands.7 *8 * This store can safely be used within either a content or background script9 * context.10 *11 * If you are looking to add a user command, follow the below steps for best12 * integration with existing components:13 * 1. Add a command below in cvox.CommandStore.CMD_WHITELIST. Pick a14 * programmatic name and fill in each of the relevant JSON keys.15 * Be sure to add a msg id and define it in chromevox/messages/messages.js which16 * describes the command. Please also add a category msg id so that the command17 * will show up in the options page.18 * 2. Add the command's logic to cvox.UserCommands inside of our switch-based19 * dispatch method (doCommand_).20 * 3. Add a key binding in chromevox/background/keymaps/classic_keymap.json and21 * chromevox/background/keymaps/flat_keymap.json.22 *23 * Class description:24 * This class is entirely static and holds a JSON structure that stores25 * commands and their associated metadata.26 *27 * From this metadata, we compute relevant subsets of data such as all present28 * categories.29 */30goog.provide('cvox.CommandStore');31goog.require('cvox.PlatformFilter');32/**33 * Returns all of the categories in the store as an array.34 * @return {Array<string>} The collection of categories.35 */36cvox.CommandStore.categories = function() {37 var categorySet = {};38 for (var cmd in cvox.CommandStore.CMD_WHITELIST) {39 var struct = cvox.CommandStore.CMD_WHITELIST[cmd];40 if (struct.category) {41 categorySet[struct.category] = true;42 }43 }44 var ret = [];45 for (var category in categorySet) {46 ret.push(category);47 }48 return ret;49};50/**51 * Gets a message given a command.52 * @param {string} command The command to query.53 * @return {string|undefined} The message id, if any.54 */55cvox.CommandStore.messageForCommand = function(command) {56 return (cvox.CommandStore.CMD_WHITELIST[command] || {}).msgId;57};58/**59 * Gets a category given a command.60 * @param {string} command The command to query.61 * @return {string|undefined} The command, if any.62 */63cvox.CommandStore.categoryForCommand = function(command) {64 return (cvox.CommandStore.CMD_WHITELIST[command] || {}).category;65};66/**67 * Gets all commands for a category.68 * @param {string} category The category to query.69 * @return {Array<string>} The commands, if any.70 */71cvox.CommandStore.commandsForCategory = function(category) {72 var ret = [];73 for (var cmd in cvox.CommandStore.CMD_WHITELIST) {74 var struct = cvox.CommandStore.CMD_WHITELIST[cmd];75 if (category == struct.category) {76 ret.push(cmd);77 }78 }79 return ret;80};81/**82 * List of commands and their properties83 * @type {Object<{forward: (undefined|boolean),84 * backward: (undefined|boolean),85 * announce: boolean,86 * category: (undefined|string),87 * findNext: (undefined|string),88 * doDefault: (undefined|boolean),89 * msgId: (undefined|string),90 * nodeList: (undefined|string),91 * platformFilter: (undefined|cvox.PlatformFilter),92 * skipInput: (undefined|boolean),93 * allowEvents: (undefined|boolean),94 * disallowContinuation: (undefined|boolean)}>}95 * forward: Whether this command points forward.96 * backward: Whether this command points backward. If neither forward or97 * backward are specified, it stays facing in the current direction.98 * announce: Whether to call finishNavCommand and announce the current99 * position after the command is done.100 * findNext: The id from the map above if this command is used for101 * finding next/previous of something.102 * category: The message resource describing the command's category.103 * doDefault: Whether to do the default action. This means that keys will be104 * passed through to the usual DOM capture/bubble phases.105 * msgId: The message resource describing the command.106 * nodeList: The id from the map above if this command is used for107 * showing a list of nodes.108 * platformFilter: Specifies to which platforms this command applies. If left109 * undefined, the command applies to all platforms.110 * skipInput: Explicitly skips this command when text input has focus.111 * Defaults to false.112 * disallowOOBE: Explicitly disallows this command when on chrome://oobe/*.113 * Defaults to false.114 * allowEvents: Allows EventWatcher to continue processing events which can115 * trump TTS.116 * disallowContinuation: Disallows continuous read to proceed. Defaults to117 * false.118 */119cvox.CommandStore.CMD_WHITELIST = {120 'toggleStickyMode': {announce: false,121 msgId: 'toggle_sticky_mode',122 'disallowOOBE': true,123 category: 'modifier_keys'},124 'toggleKeyPrefix': {announce: false,125 skipInput: true,126 msgId: 'prefix_key',127 'disallowOOBE': true,128 category: 'modifier_keys'},129 'passThroughMode': {announce: false,130 msgId: 'pass_through_key_description',131 category: 'modifier_keys'},132 'stopSpeech': {announce: false,133 disallowContinuation: true,134 doDefault: true,135 msgId: 'stop_speech_key',136 category: 'controlling_speech'},137 'toggleChromeVox': {announce: false,138 platformFilter: cvox.PlatformFilter.WML,139 msgId: 'toggle_chromevox_active',140 category: 'controlling_speech'},141 'toggleChromeVoxVersion': {announce: false},142 'decreaseTtsRate': {announce: false,143 msgId: 'decrease_tts_rate',144 category: 'controlling_speech'},145 'increaseTtsRate': {announce: false,146 msgId: 'increase_tts_rate',147 category: 'controlling_speech'},148 'decreaseTtsPitch': {announce: false,149 msgId: 'decrease_tts_pitch',150 category: 'controlling_speech'},151 'increaseTtsPitch': {announce: false,152 msgId: 'increase_tts_pitch',153 category: 'controlling_speech'},154 'decreaseTtsVolume': {announce: false,155 msgId: 'decrease_tts_volume',156 category: 'controlling_speech'},157 'increaseTtsVolume': {announce: false,158 msgId: 'increase_tts_volume',159 category: 'controlling_speech'},160 'cyclePunctuationEcho': {announce: false,161 msgId: 'cycle_punctuation_echo',162 category: 'controlling_speech'},163 'cycleTypingEcho': {announce: false,164 msgId: 'cycle_typing_echo',165 category: 'controlling_speech'},166 'toggleEarcons': {announce: true,167 msgId: 'toggle_earcons',168 category: 'controlling_speech'},169 'handleTab': {170 allowEvents: true,171 msgId: 'handle_tab_next',172 disallowContinuation: true,173 category: 'navigation'},174 'handleTabPrev': {175 allowEvents: true,176 msgId: 'handle_tab_prev',177 disallowContinuation: true,178 category: 'navigation'},179 'forward': {forward: true,180 announce: true,181 msgId: 'forward',182 category: 'navigation'},183 'backward': {backward: true,184 announce: true,185 msgId: 'backward',186 category: 'navigation'},187 'right': {forward: true,188 announce: true,189 msgId: 'right',190 category: 'navigation'},191 'left': {backward: true,192 announce: true,193 msgId: 'left',194 category: 'navigation'},195 'previousGranularity': {announce: true,196 msgId: 'previous_granularity',197 category: 'navigation'},198 'nextGranularity': {announce: true,199 msgId: 'next_granularity',200 category: 'navigation'},201 'previousCharacter': {backward: true,202 announce: true,203 msgId: 'previous_character',204 skipInput: true,205 category: 'navigation'},206 'nextCharacter': {forward: true,207 announce: true,208 msgId: 'next_character',209 skipInput: true,210 category: 'navigation'},211 'previousWord': {backward: true,212 announce: true,213 msgId: 'previous_word',214 skipInput: true,215 category: 'navigation'},216 'nextWord': {forward: true,217 announce: true,218 msgId: 'next_word',219 skipInput: true,220 category: 'navigation'},221 'previousLine': {backward: true,222 announce: true,223 msgId: 'previous_line',224 category: 'navigation'},225 'nextLine': {forward: true,226 announce: true,227 msgId: 'next_line',228 category: 'navigation'},229 'previousSentence': {backward: true,230 announce: true,231 msgId: 'previous_sentence',232 skipInput: true,233 category: 'navigation'},234 'nextSentence': {forward: true,235 announce: true,236 msgId: 'next_sentence',237 skipInput: true,238 category: 'navigation'},239 'previousObject': {backward: true,240 announce: true,241 msgId: 'previous_object',242 skipInput: true,243 category: 'navigation'},244 'nextObject': {forward: true,245 announce: true,246 msgId: 'next_object',247 skipInput: true,248 category: 'navigation'},249 'previousGroup': {backward: true,250 announce: true,251 msgId: 'previous_group',252 skipInput: true,253 category: 'navigation'},254 'nextGroup': {forward: true,255 announce: true,256 msgId: 'next_group',257 skipInput: true,258 category: 'navigation'},259 'jumpToTop': {forward: true,260 announce: true,261 msgId: 'jump_to_top',262 category: 'navigation'263},264 'jumpToBottom': {backward: true,265 announce: true,266 msgId: 'jump_to_bottom',267 category: 'navigation'},268 // Intentionally uncategorized.269 'moveToStartOfLine': {forward: true, announce: true},270 'moveToEndOfLine': {backward: true, announce: true},271 'readFromHere': {forward: true,272 announce: false,273 msgId: 'read_from_here',274 category: 'navigation'},275 'performDefaultAction': {disallowContinuation: true,276 msgId: 'perform_default_action',277 doDefault: true,278 skipInput: true,279 category: 'navigation'},280 'forceClickOnCurrentItem': {announce: true,281 disallowContinuation: true,282 allowEvents: true,283 msgId: 'force_click_on_current_item',284 category: 'navigation'},285 'forceDoubleClickOnCurrentItem': {announce: true,286 allowEvents: true,287 disallowContinuation: true},288 'readLinkURL': {announce: false,289 msgId: 'read_link_url',290 category: 'information'},291 'readCurrentTitle': {announce: false,292 msgId: 'read_current_title',293 category: 'information'},294 'readCurrentURL': {announce: false,295 msgId: 'read_current_url',296 category: 'information'},297 'fullyDescribe': {announce: false,298 msgId: 'fully_describe',299 category: 'information'},300 'speakTimeAndDate': {announce: false,301 msgId: 'speak_time_and_date',302 category: 'information'},303 'toggleSelection': {announce: true,304 msgId: 'toggle_selection',305 category: 'information'},306 'toggleSearchWidget': {announce: false,307 disallowContinuation: true,308 msgId: 'toggle_search_widget',309 category: 'information'},310 'toggleKeyboardHelp': {announce: false,311 disallowContinuation: true,312 msgId: 'show_power_key',313 category: 'help_commands'},314 'help': {announce: false,315 msgId: 'help',316 'disallowOOBE': true,317 disallowContinuation: true,318 category: 'help_commands'},319 'contextMenu': {announce: false,320 disallowContinuation: true},321 'showOptionsPage': {announce: false,322 disallowContinuation: true,323 msgId: 'show_options_page',324 'disallowOOBE': true,325 category: 'help_commands'},326 'showKbExplorerPage': {announce: false,327 disallowContinuation: true,328 msgId: 'show_kb_explorer_page',329 'disallowOOBE': true,330 category: 'help_commands'},331 'showFormsList': {announce: false,332 disallowContinuation: true,333 nodeList: 'formField',334 msgId: 'show_forms_list',335 category: 'overview'},336 'showHeadingsList': {announce: false, nodeList: 'heading',337 disallowContinuation: true,338 msgId: 'show_headings_list',339 category: 'overview'},340 'showLandmarksList': {announce: false, nodeList: 'landmark',341 disallowContinuation: true,342 msgId: 'show_landmarks_list',343 category: 'overview'},344 'showLinksList': {announce: false, nodeList: 'link',345 disallowContinuation: true,346 msgId: 'show_links_list',347 category: 'overview'},348 'showTablesList': {announce: false, nodeList: 'table',349 disallowContinuation: true,350 msgId: 'show_tables_list',351 category: 'overview'},352 'nextArticle': {forward: true,353 findNext: 'article'},354 'nextButton': {forward: true,355 findNext: 'button',356 msgId: 'next_button',357 category: 'jump_commands'},358 'nextCheckbox': {forward: true,359 findNext: 'checkbox',360 msgId: 'next_checkbox',361 category: 'jump_commands'},362 'nextComboBox': {forward: true,363 findNext: 'combobox',364 msgId: 'next_combo_box',365 category: 'jump_commands'},366 'nextControl': {forward: true, findNext: 'control'},367 'nextEditText': {forward: true,368 findNext: 'editText',369 msgId: 'next_edit_text',370 category: 'jump_commands'},371 'nextFormField': {forward: true,372 findNext: 'formField',373 msgId: 'next_form_field',374 category: 'jump_commands'},375 'nextGraphic': {forward: true,376 findNext: 'graphic',377 msgId: 'next_graphic',378 category: 'jump_commands'},379 'nextHeading': {forward: true,380 findNext: 'heading',381 msgId: 'next_heading',382 category: 'jump_commands'},383 'nextHeading1': {forward: true,384 findNext: 'heading1',385 msgId: 'next_heading1',386 category: 'jump_commands'},387 'nextHeading2': {forward: true,388 findNext: 'heading2',389 msgId: 'next_heading2',390 category: 'jump_commands'},391 'nextHeading3': {forward: true,392 findNext: 'heading3',393 msgId: 'next_heading3',394 category: 'jump_commands'},395 'nextHeading4': {forward: true,396 findNext: 'heading4',397 msgId: 'next_heading4',398 category: 'jump_commands'},399 'nextHeading5': {forward: true,400 findNext: 'heading5',401 msgId: 'next_heading5',402 category: 'jump_commands'},403 'nextHeading6': {forward: true,404 findNext: 'heading6',405 msgId: 'next_heading6',406 category: 'jump_commands'},407 'nextLandmark': {forward: true,408 findNext: 'landmark',409 msgId: 'next_landmark',410 category: 'jump_commands'},411 'nextLink': {forward: true,412 findNext: 'link',413 msgId: 'next_link',414 category: 'jump_commands'},415 'nextList': {forward: true,416 findNext: 'list',417 msgId: 'next_list',418 category: 'jump_commands'},419 'nextListItem': {forward: true,420 findNext: 'listItem',421 msgId: 'next_list_item',422 category: 'jump_commands'},423 'nextMath': {forward: true,424 findNext: 'math',425 msgId: 'next_math',426 category: 'jump_commands'},427 'nextMedia': {forward: true,428 findNext: 'media',429 msgId: 'next_media',430 category: 'jump_commands'},431 'nextRadio': {forward: true,432 findNext: 'radio',433 msgId: 'next_radio',434 category: 'jump_commands'},435 'nextSection': {forward: true, findNext: 'section'},436 'nextSlider': {forward: true, findNext: 'slider'},437 'nextTable': {forward: true,438 findNext: 'table',439 msgId: 'next_table',440 category: 'jump_commands'},441 'nextVisitedLink': {forward: true,442 findNext: 'visitedLink',443 msgId: 'next_visited_link',444 category: 'jump_commands'},445 'previousArticle': {backward: true,446 findNext: 'article'},447 'previousButton': {backward: true,448 findNext: 'button',449 msgId: 'previous_button',450 category: 'jump_commands'},451 'previousCheckbox': {backward: true,452 findNext: 'checkbox',453 msgId: 'previous_checkbox',454 category: 'jump_commands'},455 'previousComboBox': {backward: true,456 findNext: 'combobox',457 msgId: 'previous_combo_box',458 category: 'jump_commands'},459 'previousControl': {backward: true, findNext: 'control'},460 'previousEditText': {backward: true,461 findNext: 'editText',462 msgId: 'previous_edit_text',463 category: 'jump_commands'},464 'previousFormField': {backward: true,465 findNext: 'formField',466 msgId: 'previous_form_field',467 category: 'jump_commands'},468 'previousGraphic': {backward: true,469 findNext: 'graphic',470 msgId: 'previous_graphic',471 category: 'jump_commands'},472 'previousHeading': {backward: true,473 findNext: 'heading',474 msgId: 'previous_heading',475 category: 'jump_commands'},476 'previousHeading1': {backward: true,477 findNext: 'heading1',478 msgId: 'previous_heading1',479 category: 'jump_commands'},480 'previousHeading2': {backward: true,481 findNext: 'heading2',482 msgId: 'previous_heading2',483 category: 'jump_commands'},484 'previousHeading3': {backward: true,485 findNext: 'heading3',486 msgId: 'previous_heading3',487 category: 'jump_commands'},488 'previousHeading4': {backward: true,489 findNext: 'heading4',490 msgId: 'previous_heading4',491 category: 'jump_commands'},492 'previousHeading5': {backward: true,493 findNext: 'heading5',494 msgId: 'previous_heading5',495 category: 'jump_commands'},496 'previousHeading6': {backward: true,497 findNext: 'heading6',498 msgId: 'previous_heading6',499 category: 'jump_commands'},500 'previousLandmark': {backward: true,501 findNext: 'landmark',502 msgId: 'previous_landmark',503 category: 'jump_commands'},504 'previousLink': {backward: true,505 findNext: 'link',506 msgId: 'previous_link',507 category: 'jump_commands'},508 'previousList': {backward: true,509 findNext: 'list',510 msgId: 'previous_list',511 category: 'jump_commands'},512 'previousListItem': {backward: true,513 findNext: 'listItem',514 msgId: 'previous_list_item',515 category: 'jump_commands'},516 'previousMath': {backward: true,517 findNext: 'math',518 msgId: 'previous_math',519 category: 'jump_commands'},520 'previousMedia': {backward: true,521 findNext: 'media',522 msgId: 'previous_media',523 category: 'jump_commands'},524 'previousRadio': {backward: true,525 findNext: 'radio',526 msgId: 'previous_radio',527 category: 'jump_commands'},528 'previousSection': {backward: true, findNext: 'section'},529 'previousSlider': {backward: true, findNext: 'slider'},530 'previousTable': {backward: true,531 findNext: 'table',532 msgId: 'previous_table',533 category: 'jump_commands'},534 'previousVisitedLink': {backward: true,535 findNext: 'visitedLink',536 msgId: 'previous_visited_link',537 category: 'jump_commands'},538 // Table Actions.539 'announceHeaders': {announce: false,540 msgId: 'announce_headers',541 category: 'tables'},542 'speakTableLocation': {announce: false,543 msgId: 'speak_table_location',544 category: 'tables'},545 'goToFirstCell': {announce: true,546 msgId: 'skip_to_beginning',547 category: 'tables'},548 'goToLastCell': {announce: true,549 msgId: 'skip_to_end',550 category: 'tables'},551 'goToRowFirstCell': {announce: true,552 msgId: 'skip_to_row_beginning',553 category: 'tables'},554 'goToRowLastCell': {announce: true,555 msgId: 'skip_to_row_end',556 category: 'tables'},557 'goToColFirstCell': {announce: true,558 msgId: 'skip_to_col_beginning',559 category: 'tables'},560 'goToColLastCell': {announce: true,561 msgId: 'skip_to_col_end',562 category: 'tables'},563 // These commands are left out of the options page because they involve564 // multiple, non-user configurable modifiers.565 'previousRow': {backward: true, announce: true, skipInput: true},566 'previousCol': {backward: true, announce: true, skipInput: true},567 'nextRow': {forward: true, announce: true, skipInput: true},568 'nextCol': {forward: true, announce: true, skipInput: true},569 // Generic Actions.570 'enterShifter': {announce: true,571 msgId: 'enter_content',572 category: 'navigation'},573 'exitShifter': {announce: true,574 msgId: 'exit_content',575 category: 'navigation'},576 'exitShifterContent': {announce: true},577 'openLongDesc': {announce: false,578 msgId: 'open_long_desc',579 category: 'information'},580 'pauseAllMedia': {announce: false,581 msgId: 'pause_all_media',582 category: 'information'},583 // Math specific commands.584 'toggleSemantics': {announce: false,585 msgId: 'toggle_semantics',586 category: 'information'},587 // Braille specific commands.588 'routing': {announce: false,589 allowEvents: true,590 msgId: 'braille_routing',591 category: 'braille'},592 'pan_left': {backward: true,593 announce: true,594 msgId: 'braille_pan_left',595 category: 'braille'},596 'pan_right': {forward: true,597 announce: true,598 msgId: 'braille_pan_right',599 category: 'braille'},600 'line_up': {backward: true,601 announce: true,602 msgId: 'braille_line_up',603 category: 'braille'},604 'line_down': {forward: true,605 announce: true,606 msgId: 'braille_line_down',607 category: 'braille'},608 'top': {forward: true,609 announce: true,610 msgId: 'braille_top',611 category: 'braille'},612 'bottom': {backward: true,613 announce: true,614 msgId: 'braille_bottom',615 category: 'braille'},616 // Developer commands.617 'enableConsoleTts': {announce: false,618 msgId: 'enable_tts_log',619 category: 'developer'},620 'toggleBrailleCaptions': {announce: false,621 msgId: 'braille_captions',622 category: 'developer'},623 'startHistoryRecording': {announce: false},624 'stopHistoryRecording': {announce: false},625 'autorunner': {announce: false},626 'debug': {announce: false},627 'nop': {announce: false}628};629/**630 * List of find next commands and their associated data.631 * @type {Object<{predicate: string,632 * forwardError: string,633 * backwardError: string}>}634 * predicate: The name of the predicate. This must be defined in DomPredicates.635 * forwardError: The message id of the error string when moving forward.636 * backwardError: The message id of the error string when moving backward.637 */638cvox.CommandStore.NODE_INFO_MAP = {639 'checkbox': {predicate: 'checkboxPredicate',640 forwardError: 'no_next_checkbox',641 backwardError: 'no_previous_checkbox',642 typeMsg: 'role_checkbox'},643 'radio': {predicate: 'radioPredicate',644 forwardError: 'no_next_radio_button',645 backwardError: 'no_previous_radio_button',646 typeMsg: 'role_radio'},647 'slider': {predicate: 'sliderPredicate',648 forwardError: 'no_next_slider',649 backwardError: 'no_previous_slider',650 typeMsg: 'role_slider'},651 'graphic': {predicate: 'graphicPredicate',652 forwardError: 'no_next_graphic',653 backwardError: 'no_previous_graphic',654 typeMsg: 'UNUSED'},655 'article': {predicate: 'articlePredicate',656 forwardError: 'no_next_ARTICLE',657 backwardError: 'no_previous_ARTICLE',658 typeMsg: 'TAG_ARTICLE'},659 'button': {predicate: 'buttonPredicate',660 forwardError: 'no_next_button',661 backwardError: 'no_previous_button',662 typeMsg: 'role_button'},663 'combobox': {predicate: 'comboBoxPredicate',664 forwardError: 'no_next_combo_box',665 backwardError: 'no_previous_combo_box',666 typeMsg: 'role_combobox'},667 'editText': {predicate: 'editTextPredicate',668 forwardError: 'no_next_edit_text',669 backwardError: 'no_previous_edit_text',670 typeMsg: 'input_type_text'},671 'heading': {predicate: 'headingPredicate',672 forwardError: 'no_next_heading',673 backwardError: 'no_previous_heading',674 typeMsg: 'role_heading'},675 'heading1': {predicate: 'heading1Predicate',676 forwardError: 'no_next_heading_1',677 backwardError: 'no_previous_heading_1'},678 'heading2': {predicate: 'heading2Predicate',679 forwardError: 'no_next_heading_2',680 backwardError: 'no_previous_heading_2'},681 'heading3': {predicate: 'heading3Predicate',682 forwardError: 'no_next_heading_3',683 backwardError: 'no_previous_heading_3'},684 'heading4': {predicate: 'heading4Predicate',685 forwardError: 'no_next_heading_4',686 backwardError: 'no_previous_heading_4'},687 'heading5': {predicate: 'heading5Predicate',688 forwardError: 'no_next_heading_5',689 backwardError: 'no_previous_heading_5'},690 'heading6': {predicate: 'heading6Predicate',691 forwardError: 'no_next_heading_6',692 backwardError: 'no_previous_heading_6'},693 'link': {predicate: 'linkPredicate',694 forwardError: 'no_next_link',695 backwardError: 'no_previous_link',696 typeMsg: 'role_link'},697 'table': {predicate: 'tablePredicate',698 forwardError: 'no_next_table',699 backwardError: 'no_previous_table',700 typeMsg: 'table_strategy'},701 'visitedLink': {predicate: 'visitedLinkPredicate',702 forwardError: 'no_next_visited_link',703 backwardError: 'no_previous_visited_link',704 typeMsg: 'role_link'},705 'list': {predicate: 'listPredicate',706 forwardError: 'no_next_list',707 backwardError: 'no_previous_list',708 typeMsg: 'role_list'},709 'listItem': {predicate: 'listItemPredicate',710 forwardError: 'no_next_list_item',711 backwardError: 'no_previous_list_item',712 typeMsg: 'role_listitem'},713 'formField': {predicate: 'formFieldPredicate',714 forwardError: 'no_next_form_field',715 backwardError: 'no_previous_form_field',716 typeMsg: 'role_form'},717 'landmark': {predicate: 'landmarkPredicate',718 forwardError: 'no_next_landmark',719 backwardError: 'no_previous_landmark',720 typeMsg: 'role_landmark'},721 'math': {predicate: 'mathPredicate',722 forwardError: 'no_next_math',723 backwardError: 'no_previous_math',724 typeMsg: 'math_expr'},725 'media': {predicate: 'mediaPredicate',726 forwardError: 'no_next_media_widget',727 backwardError: 'no_previous_media_widget'},728 'section': {predicate: 'sectionPredicate',729 forwardError: 'no_next_section',730 backwardError: 'no_previous_section'},731 'control': {predicate: 'controlPredicate',732 forwardError: 'no_next_control',733 backwardError: 'no_previous_control'}...

Full Screen

Full Screen

browser_bug650345_find.js

Source:browser_bug650345_find.js Github

copy

Full Screen

...39 is(editor.lastFind.index, 0, "lastFind.index is correct");40 is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");41 is(editor.lastFind.ignoreCase, false, "lastFind.ignoreCase is correct");42 let newIndex = text.indexOf(needle, needle.length);43 is(editor.findNext(), newIndex, "findNext() works");44 is(editor.lastFind.str, needle, "lastFind.str is correct");45 is(editor.lastFind.index, newIndex, "lastFind.index is correct");46 is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");47 is(editor.lastFind.ignoreCase, false, "lastFind.ignoreCase is correct");48 is(editor.findNext(), -1, "findNext() works again");49 is(editor.lastFind.index, -1, "lastFind.index is correct");50 is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");51 is(editor.findPrevious(), 0, "findPrevious() works");52 is(editor.lastFind.index, 0, "lastFind.index is correct");53 is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");54 is(editor.findPrevious(), -1, "findPrevious() works again");55 is(editor.lastFind.index, -1, "lastFind.index is correct");56 is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");57 is(editor.findNext(), newIndex, "findNext() works");58 is(editor.lastFind.index, newIndex, "lastFind.index is correct");59 is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");60 is(editor.findNext(true), 0, "findNext(true) works");61 is(editor.lastFind.index, 0, "lastFind.index is correct");62 is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");63 is(editor.findNext(true), newIndex, "findNext(true) works again");64 is(editor.lastFind.index, newIndex, "lastFind.index is correct");65 is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");66 is(editor.findPrevious(true), 0, "findPrevious(true) works");67 is(editor.lastFind.index, 0, "lastFind.index is correct");68 is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");69 is(editor.findPrevious(true), newIndex, "findPrevious(true) works again");70 is(editor.lastFind.index, newIndex, "lastFind.index is correct");71 is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");72 needle = "error";73 is(editor.find(needle), -1, "find('" + needle + "') works");74 is(editor.lastFind.str, needle, "lastFind.str is correct");75 is(editor.lastFind.index, -1, "lastFind.index is correct");76 is(editor.lastFind.lastFound, -1, "lastFind.lastFound is correct");77 is(editor.lastFind.ignoreCase, false, "lastFind.ignoreCase is correct");78 is(editor.findNext(), -1, "findNext() works");79 is(editor.lastFind.str, needle, "lastFind.str is correct");80 is(editor.lastFind.index, -1, "lastFind.index is correct");81 is(editor.lastFind.lastFound, -1, "lastFind.lastFound is correct");82 is(editor.findNext(true), -1, "findNext(true) works");83 is(editor.findPrevious(), -1, "findPrevious() works");84 is(editor.findPrevious(true), -1, "findPrevious(true) works");85 needle = "bug650345";86 newIndex = text.indexOf(needle);87 is(editor.find(needle), newIndex, "find('" + needle + "') works");88 is(editor.findNext(), -1, "findNext() works");89 is(editor.findNext(true), newIndex, "findNext(true) works");90 is(editor.findPrevious(), -1, "findPrevious() works");91 is(editor.findPrevious(true), newIndex, "findPrevious(true) works");92 is(editor.lastFind.index, newIndex, "lastFind.index is correct");93 is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");94 is(editor.find(needle, {ignoreCase: 1}), newIndex,95 "find('" + needle + "', {ignoreCase: 1}) works");96 is(editor.lastFind.ignoreCase, true, "lastFind.ignoreCase is correct");97 let newIndex2 = text.toLowerCase().indexOf(needle, newIndex + needle.length);98 is(editor.findNext(), newIndex2, "findNext() works");99 is(editor.findNext(), -1, "findNext() works");100 is(editor.lastFind.index, -1, "lastFind.index is correct");101 is(editor.lastFind.lastFound, newIndex2, "lastFind.lastFound is correct");102 is(editor.findNext(true), newIndex, "findNext(true) works");103 is(editor.findPrevious(), -1, "findPrevious() works");104 is(editor.findPrevious(true), newIndex2, "findPrevious(true) works");105 is(editor.findPrevious(), newIndex, "findPrevious() works again");106 needle = "foobar";107 newIndex = text.indexOf(needle, 2);108 is(editor.find(needle, {start: 2}), newIndex,109 "find('" + needle + "', {start:2}) works");110 is(editor.findNext(), -1, "findNext() works");111 is(editor.findNext(true), 0, "findNext(true) works");112 editor.destroy();113 testWin.close();114 testWin = editor = null;115 waitForFocus(finish, window);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var path = require('path');3var fs = require('fs');4var util = require('util');5var testpath = path.join(process.cwd(),'test.js');6var testpath2 = path.join(process.cwd(),'test2.js');7var testpath3 = path.join(process.cwd(),'test3.js');8var testpath4 = path.join(process.cwd(),'test4.js');9var testpath5 = path.join(process.cwd(),'test5.js');10var testpath6 = path.join(process.cwd(),'test6.js');11var testpath7 = path.join(process.cwd(),'test7.js');12var testpath8 = path.join(process.cwd(),'test8.js');13var testpath9 = path.join(process.cwd(),'test9.js');14var testpath10 = path.join(process.cwd(),'test10.js');15var testpath11 = path.join(process.cwd(),'test11.js');16var testpath12 = path.join(process.cwd(),'test12.js');17var testpath13 = path.join(process.cwd(),'test13.js');18var testpath14 = path.join(process.cwd(),'test14.js');19var testpath15 = path.join(process.cwd(),'test15.js');20var testpath16 = path.join(process.cwd(),'test16.js');21var testpath17 = path.join(process.cwd(),'test17.js');22var testpath18 = path.join(process.cwd(),'test18.js');23var testpath19 = path.join(process.cwd(),'test19.js');24var testpath20 = path.join(process.cwd(),'test20.js');25var testpath21 = path.join(process.cwd(),'test21.js');26var testpath22 = path.join(process.cwd(),'test22.js');27var testpath23 = path.join(process.cwd(),'test23.js');28var testpath24 = path.join(process.cwd(),'test24.js');29var testpath25 = path.join(process.cwd(),'test25.js');30var testpath26 = path.join(process.cwd(),'test26.js');31var testpath27 = path.join(process.cwd(),'test27.js');32var testpath28 = path.join(process.cwd(),'test28.js');33var testpath29 = path.join(process.cwd(),'test29.js');34var testpath30 = path.join(process.cwd(),'test30.js');35var testpath31 = path.join(process.cwd(),'test31.js');

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var path = require('path');3var fs = require('fs');4var pathToSearch = path.join(__dirname, 'test');5var filenameToSearch = 'test.txt';6var options = {7};8var nextPath = redwood.findNext(options);9console.log('nextPath: ' + nextPath);

Full Screen

Using AI Code Generation

copy

Full Screen

1const redwood = require('redwood-sdk');2async function main(){3 await redwood.init();4 let next = await redwood.findNext(0);5 console.log(next);6}7main();

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var redwoodClient = new redwood.RedwoodClient();3var myClient = redwoodClient.getClient();4myClient.connect(function(err, db) {5 if (err) {6 console.log("Unable to connect to Mongo.");7 process.exit(1);8 } else {9 console.log("Connected to Mongo.");10 var collection = db.collection('test');11 var cursor = collection.find();12 cursor.findNext(function(err, doc) {13 if (err) {14 console.log("Error: " + err);15 } else {16 console.log("Found: " + doc);17 }18 });19 }20});21var redwood = require('redwood');22var redwoodClient = new redwood.RedwoodClient();23var myClient = redwoodClient.getClient();24myClient.connect(function(err, db) {25 if (err) {26 console.log("Unable to connect to Mongo.");27 process.exit(1);28 } else {29 console.log("Connected to Mongo.");30 var collection = db.collection('test');31 var cursor = collection.find();32 cursor.findNext(function(err, doc) {33 if (err) {34 console.log("Error: " + err);35 } else {36 console.log("Found: " + doc);37 }38 });39 }40});41var redwood = require('redwood');42var redwoodClient = new redwood.RedwoodClient();43var myClient = redwoodClient.getClient();44myClient.connect(function(err, db) {45 if (err) {46 console.log("Unable to connect to Mongo.");47 process.exit(1);48 } else {49 console.log("Connected to Mongo.");50 var collection = db.collection('test');51 var cursor = collection.find();52 cursor.findNext(function(err, doc) {53 if (err) {54 console.log("Error: " + err);55 } else {56 console.log("Found: " + doc);57 }58 });59 }60});61var redwood = require('redwood');62var redwoodClient = new redwood.RedwoodClient();63var myClient = redwoodClient.getClient();64myClient.connect(function(err, db) {

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var path = require('path');3var fs = require('fs');4var pathToSearch = path.join(__dirname, 'test');5var options = {6};7var files = redwood.findNext(pathToSearch, options);8console.log(files);9### findNext(path, options)

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var findNext = redwood.findNext;3var findNextSync = redwood.findNextSync;4var options = {5};6findNext(options, function(err, file) {7 if (err) {8 console.log("Error: " + err);9 } else {10 console.log("File: " + file);11 }12});13var file = findNextSync(options);14console.log("File: " + file);

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('./redwood.js');2var test = new redwood.Redwood();3test.insert(5);4test.insert(3);5test.insert(7);6test.insert(2);7test.insert(4);8test.insert(6);9test.insert(8);10var node = test.find(7);11console.log("Node: " + node.value);12console.log("Next: " + test.findNext(node).value);13console.log("Previous: " + test.findPrevious(node).value);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run redwood automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful