protected function StyleguidePaletteTest::testInvalidSwatches in Style Guide 7
Tests adding invalid swatches.
File
- styleguide_palette/
styleguide_palette.test, line 171 - Tests for styleguide_palette.module.
Class
- StyleguidePaletteTest
- Tests style guide palette functionality.
Code
protected function testInvalidSwatches() {
$edit = array(
'name' => $this
->randomName(),
);
$this
->drupalPost('admin/config/user-interface/styleguide-palette/edit', $edit, t('Save palette'));
$this
->assertText(t('Missing swatch hex value.'));
$this
->assertNoText(t('Style guide swatches added.'));
$edit = array(
'hex' => '#123456',
);
$this
->drupalPost('admin/config/user-interface/styleguide-palette/edit', $edit, t('Save palette'));
$this
->assertText(t('Missing swatch name.'));
$this
->assertNoText(t('Style guide swatches added.'));
$edit = array(
'name' => $this
->randomName(),
'hex' => '#12345',
);
$this
->drupalPost('admin/config/user-interface/styleguide-palette/edit', $edit, t('Save palette'));
$this
->assertRaw(t('%name must be a valid hexadecimal CSS color value.', array(
'%name' => 'Hex value',
)));
$this
->assertNoText(t('Style guide swatches added.'));
}