/[drupal]/contributions/modules/simpletest_automator/simpletest_automator.module
ViewVC logotype

Diff of /contributions/modules/simpletest_automator/simpletest_automator.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.41, Thu Aug 21 03:13:32 2008 UTC revision 1.42, Thu Aug 21 03:45:17 2008 UTC
# Line 349  function simpletest_automator_simpletest Line 349  function simpletest_automator_simpletest
349        // The keys should be the internal action names, while the values will be        // The keys should be the internal action names, while the values will be
350        // presented to the user.        // presented to the user.
351        return array(        return array(
352            'assert_text' => t('Make sure text appears'),
353          'click_link' => t('Click on a link'),          'click_link' => t('Click on a link'),
354        );        );
355    
# Line 382  function _simpletest_automator_describe_ Line 383  function _simpletest_automator_describe_
383    switch ($action->type) {    switch ($action->type) {
384      case 'click_link':      case 'click_link':
385        return t('This will scan the current page for links with the label %label, and simulate a "click" on the #@index link.', array('%label' => $action->parameters['label'], '@index' => $action->parameters['index'] + 1));        return t('This will scan the current page for links with the label %label, and simulate a "click" on the #@index link.', array('%label' => $action->parameters['label'], '@index' => $action->parameters['index'] + 1));
386    
387        case 'assert_text':
388          if ($action->parameters['should_appear']) {
389            return t('This will look at all the text on the current page, and make sure that the text %text appears.', array('%text' => $action->parameters['text']));
390          }
391          else {
392            return t('This will look at all the text on the current page, and make sure that the text %text does <strong>not</strong> appear.', array('%text' => $action->parameters['text']));
393          }
394    }    }
395  }  }
396    
# Line 413  function _simpletest_automator_export_ac Line 422  function _simpletest_automator_export_ac
422          );          );
423        }        }
424        break;        break;
425    
426        case 'assert_text':
427          $assert = 'assert';
428          if (!$action->parameters['should_appear']) {
429            $assert .= 'No';
430          }
431          $assert .= $action->parameters['html'] ? 'Raw' : 'Text';
432          $lines[] = array(
433            'value' => '$this->' . $assert . '(%s);',
434            'arguments' => array($action->parameters['text']),
435          );
436          break;
437    }    }
438    return $lines;    return $lines;
439  }  }
# Line 444  function _simpletest_automator_action_fo Line 465  function _simpletest_automator_action_fo
465          '#options' => drupal_map_assoc(range(0, 10)),          '#options' => drupal_map_assoc(range(0, 10)),
466        );        );
467        break;        break;
468    
469        case 'assert_text':
470          $form['text'] = array(
471            '#type' => 'textarea',
472            '#title' => t('Text'),
473            '#description' => t('The text to check for. This should not contain any HTML unless the "Text is HTML" option is selected below.'),
474            '#default_value' => isset($action->parameters['text']) ? $action->parameters['text'] : '',
475          );
476    
477          $form['should_appear'] = array(
478            '#type' => 'checkbox',
479            '#title' => t('Text should appear'),
480            '#description' => t('If unchecked, it will assert that the text does <strong>not</strong> appear, rather than asserting that the text <strong>should</strong> appear.'),
481            '#default_value' => isset($action->parameters['should_appear']) ? $action->parameters['should_appear'] : TRUE,
482          );
483    
484          $form['html'] = array(
485            '#type' => 'checkbox',
486            '#title' => t('Text is HTML'),
487            '#description' => t('If checked, it will cause the code to check whether the raw HTML matches, rather than simply the visible text.'),
488            '#default_value' => isset($action->parameters['should_appear']) ? $action->parameters['should_appear'] : FALSE,
489          );
490    }    }
491    return $form;    return $form;
492  }  }

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

  ViewVC Help
Powered by ViewVC 1.1.2