| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- /**
- * @file
- * Form layout tests.
- */
- class dsFormTests extends dsBaseTest {
- /**
- * Implements getInfo().
- */
- public static function getInfo() {
- return array(
- 'name' => t('Forms'),
- 'description' => t('Tests for managing layouts on forms.'),
- 'group' => t('Display Suite'),
- );
- }
- /**
- * Forms tests.
- */
- function testDSForms() {
- // Create a node.
- $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => FALSE));
- // Configure teaser layout.
- $form = array(
- 'additional_settings[layout]' => 'ds_2col_stacked',
- );
- $form_assert = array(
- 'regions' => array(
- 'header' => '<td colspan="8">' . t('Header') . '</td>',
- 'left' => '<td colspan="8">' . t('Left') . '</td>',
- 'right' => '<td colspan="8">' . t('Right') . '</td>',
- 'footer' => '<td colspan="8">' . t('Footer') . '</td>',
- ),
- );
- $this->dsSelectLayout($form, $form_assert, 'admin/structure/types/manage/article/fields');
- $fields = array(
- 'fields[title][region]' => 'header',
- 'fields[body][region]' => 'left',
- 'fields[field_image][region]' => 'right',
- 'fields[field_tags][region]' => 'right',
- );
- $this->dsConfigureUI($fields, 'admin/structure/types/manage/article/fields');
- // Inspect the node.
- $this->drupalGet('node/' . $node->nid . '/edit');
- $this->assertRaw('ds_2col_stacked', 'ds-form class added');
- $this->assertRaw('group-header', 'Template found (region header)');
- $this->assertRaw('group-left', 'Template found (region left)');
- $this->assertRaw('group-right', 'Template found (region right)');
- $this->assertRaw('group-footer', 'Template found (region footer)');
- $this->assertRaw('edit-title', 'Title field found');
- $this->assertRaw('edit-submit', 'Submit field found');
- $this->assertRaw('edit-field-tags-und', 'Tags field found');
- $this->assertRaw('edit-log', 'Revision log found');
- }
- }
|