| 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 |
|
|
| 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 |
|
|
| 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 |
} |
} |
| 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 |
} |
} |