Remove tab tests

refs #4639
This commit is contained in:
Johannes Meyer 2014-04-14 12:50:16 +02:00
parent 1ed1c0bc3c
commit 4667a53121
2 changed files with 0 additions and 199 deletions

View File

@ -1,128 +0,0 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Tests\Icinga\Web\Widget;
use Icinga\Test\BaseTestCase;
use Tests\Icinga\Web\ViewMock;
use Icinga\Web\Widget\Tab;
use Icinga\Web\Url;
/**
* Test creation and rendering of tabs
*/
class TabTest extends BaseTestCase
{
/**
* Test whether rendering a tab without URL is done correctly
*/
public function testRenderWithoutUrl()
{
$this->markTestSkipped('We cannot pass view objects to widgets anymore!1!!11!!1!!!');
$tab = new Tab(array("name" => "tab", "title" => "Title text"));
$html = $tab->render(new ViewMock());
$this->assertEquals(
1,
preg_match(
'/<li *> *Title text *<\/li> */i',
$html
),
"Asserting an tab without url only showing a title, , got " . $html
);
}
/**
* Test whether rendering an active tab adds the 'class' property
*/
public function testActiveTab()
{
$this->markTestSkipped('We cannot pass view objects to widgets anymore!1!!11!!1!!!');
$tab = new Tab(array("name" => "tab", "title" => "Title text"));
$tab->setActive(true);
$html = $tab->render(new ViewMock());
$this->assertEquals(
1,
preg_match(
'/<li *class="active" *> *Title text *<\/li> */i',
$html
),
"Asserting an active tab having the 'active' class provided, got " . $html
);
}
/**
* Test whether rendering a tab with URL adds a n &gt;a&lt; tag correctly
*/
public function testTabWithUrl()
{
$this->markTestSkipped('We cannot pass view objects to widgets anymore!1!!11!!1!!!');
$tab = new Tab(
array(
"name" => "tab",
"title" => "Title text",
"url" => Url::fromPath("my/url")
)
);
$html = $tab->render(new ViewMock());
$this->assertEquals(
1,
preg_match(
'/<li *><a href="\/my\/url".*>Title text<\/a><\/li>/i',
$html
),
'Asserting an url being rendered inside an HTML anchor. got ' . $html
);
}
/**
* Test wheter the 'icon' property adds an img tag
*/
public function testTabWithIconImage()
{
$this->markTestSkipped('We cannot pass view objects to widgets anymore!1!!11!!1!!!');
$tab = new Tab(
array(
"name" => "tab",
"title" => "Title text",
"icon" => Url::fromPath("my/url")
)
);
$html = $tab->render(new ViewMock());
$this->assertEquals(
1,
preg_match(
'/<li *><img src="\/my\/url" .*?\/> Title text<\/li>/i',
$html
),
'Asserting an url being rendered inside an HTML anchor. got ' . $html
);
}
/**
* Test wheter the iconCls property adds an i tag with the icon
*/
public function testTabWithIconClass()
{
$this->markTestSkipped('We cannot pass view objects to widgets anymore!1!!11!!1!!!');
$tab = new Tab(
array(
"name" => "tab",
"title" => "Title text",
"iconCls" => "myIcon"
)
);
$html = $tab->render(new ViewMock());
$this->assertEquals(
1,
preg_match(
'/<li *><i class="myIcon"><\/i> Title text<\/li>/i',
$html
),
'Asserting an url being rendered inside an HTML anchor. got ' . $html
);
}
}

View File

@ -1,71 +0,0 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Tests\Icinga\Web\Widget;
use Icinga\Test\BaseTestCase;
use Tests\Icinga\Web\ViewMock;
use Icinga\Web\Widget\Tabs;
/**
* Test rendering of tabs and corretct tab management
*/
class TabsTest extends BaseTestCase
{
/**
* Test adding tabs and asserting for correct count
*/
public function testAddTabs()
{
$tabs = new Tabs();
$this->assertEquals(0, $tabs->count(), 'Asserting a tab bar starting with no items');
$tabs->add('tab1', array('title' => 'Tab 1'));
$tabs->add('tab2', array('title' => 'Tab 2'));
$this->assertEquals(2, $tabs->count(), 'Asserting a tab bar containing 2 items after being added');
$this->assertTrue(
$tabs->has('tab1'),
'Asserting the tab bar to determine the existence of added tabs correctly (tab1)'
);
$this->assertTrue(
$tabs->has('tab2'),
'Asserting the tab bar to determine the existence of added tabs correctly (tab2)'
);
}
/**
* Test rendering of tabs when no dropdown is requested
*/
public function testRenderTabsWithoutDropdown()
{
$this->markTestSkipped('We cannot pass view objects to widgets anymore!1!!11!!1!!!');
$tabs = new Tabs();
$tabs->add('tab1', array('title' => 'Tab 1'));
$tabs->add('tab2', array('title' => 'Tab 2'));
$html = $tabs->render(new ViewMock());
$this->assertContains('<li >Tab 1</li>', $html, 'Asserting tab 1 being rendered correctly' . $html);
$this->assertContains('<li >Tab 2</li>', $html, 'Asserting tab 2 being rendered correctly' . $html);
$this->assertNotContains('class="dropdown ', 'Asserting the dropdown to not be rendered' . $html);
}
/**
* Test rendering of tabs when dropdown is requested
*/
public function testRenderDropdown()
{
$this->markTestSkipped('We cannot pass view objects to widgets anymore!1!!11!!1!!!');
$tabs = new Tabs();
$tabs->add('tab1', array('title' => 'Tab 1'));
$tabs->addAsDropdown('tab2', array('title' => 'Tab 2'));
$html = $tabs->render(new ViewMock());
$this->assertContains('<li >Tab 1</li>', $html, 'Asserting tab 1 being rendered correctly ' . $html);
$this->assertContains('<li >Tab 2</li>', $html, 'Asserting tab 2 being rendered correctly ' . $html);
$this->assertContains('class="dropdown ', 'Asserting the dropdown to be rendered, got ' . $html);
}
}