getPagination(5);
$output = LinkPager::widget([
'pagination' => $pagination,
'disableCurrentPageButton' => false,
]);
$this->assertContains('6', $output);
$output = LinkPager::widget([
'pagination' => $pagination,
'disableCurrentPageButton' => true,
]);
$this->assertContains('6', $output);
}
public function testOptionsWithTagOption()
{
LinkPager::$counter = 0;
$output = LinkPager::widget([
'pagination' => $this->getPagination(5),
'options' => [
'tag' => 'div',
],
]);
$this->assertTrue(StringHelper::startsWith($output, ''));
$this->assertTrue(StringHelper::endsWith($output, '
'));
}
public function testLinkWrapOptions()
{
$output = LinkPager::widget([
'pagination' => $this->getPagination(1),
'linkContainerOptions' => [
'tag' => 'div',
'class' => 'my-class',
],
]);
$this->assertContains(
'',
$output
);
$this->assertContains(
'',
$output
);
}
/**
* @see https://github.com/yiisoft/yii2/issues/15536
*/
public function testShouldTriggerInitEvent()
{
$initTriggered = false;
LinkPager::widget([
'pagination' => $this->getPagination(1),
'on init' => function () use (&$initTriggered) {
$initTriggered = true;
}
]);
$this->assertTrue($initTriggered);
}
}