You are here

protected function StyleguidePaletteTest::testDeletingSwatches in Style Guide 7

Tests deleting an existing swatch.

File

styleguide_palette/styleguide_palette.test, line 151
Tests for styleguide_palette.module.

Class

StyleguidePaletteTest
Tests style guide palette functionality.

Code

protected function testDeletingSwatches() {

  // Add a new swatch as the admin user.
  $name = $this
    ->randomName();
  $edit = array(
    'name' => $name,
    'description' => $this
      ->randomName(),
    'hex' => '#123456',
  );
  $this
    ->drupalPost('admin/config/user-interface/styleguide-palette/edit', $edit, t('Save palette'));
  $this
    ->clickLink(t('Delete'));
  $this
    ->assertRaw(t('Are you sure you want to delete %name?', array(
    '%name' => $name,
  )));
  $this
    ->drupalPost(NULL, array(), t('Delete'));
  $this
    ->assertRaw(t('%name has been deleted.', array(
    '%name' => $name,
  )));
  $this
    ->assertNoFieldByXPath('//input[@name="palette[' . $name . '][hex]"]', '#123456', 'The deleted color swatch is not shown.');
}