1 link.ui.test LinkUITest::testStaticLinkCreate()

Tests if <strong> is used in a static title that the markup is retained.

File

core/modules/link/tests/link.ui.test, line 146
Testing CRUD API in the browser.

Class

LinkUITest
Testing that users can not input bad URLs or labels

Code

function testStaticLinkCreate() {
  $name = strtolower($this->randomName());
  $field_name = 'field_' . $name;
  $edit = array(
    'fields[_add_new_field][label]' => $name,
    'fields[_add_new_field][field_name]' => $name,
    'fields[_add_new_field][type]' => 'link_field',
    'fields[_add_new_field][widget_type]' => 'link_field',
  );
  $this->backdropPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
  $this->backdropPost(NULL, array(
    'instance[settings][title]' => 'value',
    'instance[settings][title_value]' => '<strong>' . $name . '</strong>'), t('Save settings')
  );

  $this->backdropGet('node/add/page');
  $this->assertField($field_name . '[und][0][url]', 'URL found');

  $input = array(
    'href' => 'http://example.com/' . $this->randomName()
  );

  $edit = array(
    'title' => $name,
    $field_name . '[und][0][url]' => $input['href'],
  );
  $this->backdropPost(NULL, $edit, t('Save'));

  $this->assertRaw(l('<strong>' . $name . '</strong>', $input['href'], array('html' => TRUE)));
}