1 theme.test RenderElementTypesTestCase::testContainer()

Tests Form API #type 'container'.

File

core/modules/simpletest/tests/theme.test, line 612
Tests for the theme API.

Class

RenderElementTypesTestCase
Tests the markup of core render element types passed to backdrop_render().

Code

function testContainer() {
  $elements = array(
    // Basic container with no attributes.
    array(
      'name' => "#type 'container' with no HTML attributes",
      'value' => array(
        '#type' => 'container',
        'child' => array(
          '#markup' => 'foo',
        ),
      ),
      'expected' => '<div>foo</div>',
    ),
    // Container with a class.
    array(
      'name' => "#type 'container' with a class HTML attribute",
      'value' => array(
        '#type' => 'container',
        'child' => array(
          '#markup' => 'foo',
        ),
        '#attributes' => array(
          'class' => 'bar',
        ),
      ),
      'expected' => '<div class="bar">foo</div>',
    ),
  );

  $this->assertElements($elements);
}