additional_plugins/serendipity_event_typesetbuttons/tests/buttons/StrikeButtonTest.php
Matthias Gutjahr 51710d37e9 Complete refactoring of serendipity_event_typesetbuttons
- Add new syntax for s9y 2.0
- Add button classes
- Add unit tests
2014-04-25 10:12:17 +02:00

52 lines
1.6 KiB
PHP

<?php
require_once __DIR__ . '/../../buttons/StrikeButton.php';
/**
* Class StrikeButtonTest
*/
class StrikeButtonTest extends PHPUnit_Framework_TestCase
{
/**
* @var StrikeButton
*/
protected $button;
/**
* Set up
*/
public function setUp()
{
$this->button = new StrikeButton('serendipity[body]');
}
/**
* @test
*/
public function render()
{
$expected = ' <button class="wrap_selection lang-html" type="button" name="insstrike" data-tag-open="p style=\'text-decoration: line-through;\'" data-tag-close="p" data-tarea="serendipity[body]">Strike</button>' . PHP_EOL;
$this->assertEquals($expected, $this->button->render());
}
/**
* @test
*/
public function renderInLegacyMode()
{
$this->button->setIsLegacyMode(true);
$this->button->setIsXhtml11(false);
$expected = " <input type=\"button\" class=\"serendipityPrettyButton input_button\" name=\"insstrike\" value=\"Strike\" onclick=\"wrapSelection(document.forms['serendipityEntry']['serendipity[body]'],'<s>','</s>')\" />" . PHP_EOL;
$this->assertEquals($expected, $this->button->render());
}
/**
* @test
*/
public function renderInLegacyModeAndXhtml11()
{
$this->button->setIsLegacyMode(true);
$expected = " <input type=\"button\" class=\"serendipityPrettyButton input_button\" name=\"insstrike\" value=\"Strike\" onclick=\"wrapSelection(document.forms['serendipityEntry']['serendipity[body]'],'<del>','</del>')\" />" . PHP_EOL;
$this->assertEquals($expected, $this->button->render());
}
}