You are here

protected function SelectOrOtherTestBase::assertLabelVisibleOnce in Select (or other) 7.3

Check to see if a label is visible only once.

Parameters

string $label: The label to look for.

string $element_name: The element the label should be for.

1 call to SelectOrOtherTestBase::assertLabelVisibleOnce()
SelectOrOtherTestBase::testFieldLabelVisibleOnce in tests/SelectOrOtherTestBase.test
Make sure the field label is visible only once.

File

tests/SelectOrOtherTestBase.test, line 45
Contains SelectOrOtherTestBase.

Class

SelectOrOtherTestBase
Class SelectOrOtherTestBase Base class for select_or_other testing.

Code

protected function assertLabelVisibleOnce($label, $element_name) {
  $xpath = "//label[@for[starts-with(., :element-name)] and starts-with(., :label)]";
  $arguments = array(
    ':label' => $label,
    ':element-name' => $element_name,
  );
  $message_arguments = array(
    '%label' => $label,
    '%element-name' => $element_name,
  );
  $elements = $this
    ->xpath($xpath, $arguments);
  $this
    ->assertEqual(count($elements), 1, t('%label is visible once for element %element', $message_arguments));
}