protected function StyleguidePaletteTest::testSwatchTheming in Style Guide 7
Tests theme functions.
File
- styleguide_palette/
styleguide_palette.test, line 213 - Tests for styleguide_palette.module.
Class
- StyleguidePaletteTest
- Tests style guide palette functionality.
Code
protected function testSwatchTheming() {
$expected = '';
$expected .= '<div class="styleguide-palette">' . "\n";
$expected .= '<div class="styleguide-palette-empty">' . "\n";
$expected .= ' ' . t('There are no swatches yet.');
$expected .= '</div>' . "\n";
$expected .= '</div>' . "\n";
$this
->assertThemeOutput('styleguide_palette', array(), $expected);
$edit1 = array(
'name' => $this
->randomName(),
'description' => $this
->randomName(),
'hex' => '#123456',
);
$this
->drupalPost('admin/config/user-interface/styleguide-palette/edit', $edit1, t('Save palette'));
$edit2 = array(
'name' => $this
->randomName(),
'description' => $this
->randomName(),
'hex' => '#654321',
);
$this
->drupalPost('admin/config/user-interface/styleguide-palette/edit', $edit2, t('Save palette'));
$expected = '';
$expected .= '<div class="styleguide-palette-swatch-color" style="background-color: ' . $edit1['hex'] . ';"> </div>' . "\n";
$expected .= '<h3 class="styleguide-palette-swatch-name">' . $edit1['name'] . '</h3>' . "\n";
$expected .= '<div class="styleguide-palette-swatch-hex"><em>' . $edit1['hex'] . '</em></div>' . "\n";
$expected .= '<div class="styleguide-palette-swatch-description">' . $edit1['description'] . '</div>' . "\n";
$this
->assertThemeOutput('styleguide_palette_swatch', $edit1, $expected);
$expected = '';
$expected .= '<div class="styleguide-palette">' . "\n";
$expected .= '<div class="styleguide-palette-swatch">' . "\n";
$expected .= ' ' . theme('styleguide_palette_swatch', $edit1);
$expected .= '</div>' . "\n";
$expected .= '<div class="styleguide-palette-swatch">' . "\n";
$expected .= ' ' . theme('styleguide_palette_swatch', $edit2);
$expected .= '</div>' . "\n";
$expected .= '</div>' . "\n";
$variables = array(
'swatches' => array(
$edit1,
$edit2,
),
);
$this
->assertThemeOutput('styleguide_palette', $variables, $expected);
}