protected function StyleguidePaletteTest::testEditingSwatches in Style Guide 7
Tests editing an existing palette.
File
- styleguide_palette/
styleguide_palette.test, line 130 - Tests for styleguide_palette.module.
Class
- StyleguidePaletteTest
- Tests style guide palette functionality.
Code
protected function testEditingSwatches() {
// 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'));
$edit = array(
"palette[{$name}][hex]" => '#654321',
);
$this
->drupalPost(NULL, $edit, t('Save palette'));
$this
->assertText(t('Style guide palette updated.'));
$this
->assertFieldByXPath('//input[@name="palette[' . $name . '][hex]"]', '#654321', 'The newly added color swatch is shown.');
}