[ [ 'label' => 'Page1', ], [ 'label' => 'Dropdown1', 'url' => '#test', 'items' => [ [ 'label' => 'Page2', ], [ 'label' => 'Page3', ], ], ], [ 'label' => 'Dropdown2', 'visible' => false, 'items' => [ [ 'label' => 'Page4', 'content' => 'Page4', ], [ 'label' => 'Page5', 'content' => 'Page5', ], ], ], ], ], ); $expected = << EXPECTED; $this->assertEqualsWithoutLE($expected, $out); } public function testSubMenuOptions() { Dropdown::$counter = 0; $out = Dropdown::widget( [ 'submenuOptions' => [ 'class' => 'submenu-list', ], 'items' => [ [ 'label' => 'Dropdown1', 'items' => [ [ 'label' => 'Page1', 'content' => 'Page2', ], [ 'label' => 'Page2', 'content' => 'Page3', ], ], ], '-', [ 'label' => 'Dropdown2', 'items' => [ [ 'label' => 'Page3', 'content' => 'Page4', ], [ 'label' => 'Page4', 'content' => 'Page5', ], ], 'submenuOptions' => [ 'class' => 'submenu-override', ], ], ], ], ); $expected = << EXPECTED; $this->assertEqualsWithoutLE($expected, $out); } public function testActive() { Dropdown::$counter = 0; $out = Dropdown::widget( [ 'submenuOptions' => [ 'class' => 'submenu-list', ], 'items' => [ [ 'label' => 'Dropdown1', 'items' => [ [ 'label' => 'Page1', 'content' => 'Page2', ], [ 'label' => 'Page2', 'content' => 'Page3', ], ], ], '-', [ 'label' => 'Dropdown2', 'items' => [ [ 'label' => 'Page3', 'content' => 'Page3', 'url' => '/', 'active' => true, ], [ 'label' => 'Page4', 'content' => 'Page4', ], ], ], ], ], ); $expected = << HTML; $this->assertEqualsWithoutLE($expected, $out); } public function testDisabled() { Dropdown::$counter = 0; $out = Dropdown::widget( [ 'submenuOptions' => [ 'class' => 'submenu-list', ], 'items' => [ [ 'label' => 'Dropdown1', 'items' => [ [ 'label' => 'Page1', 'content' => 'Page2', ], [ 'label' => 'Page2', 'content' => 'Page3', ], ], 'disabled' => true, ], '-', [ 'label' => 'Dropdown2', 'items' => [ [ 'label' => 'Page3', 'content' => 'Page3', ], [ 'label' => 'Page4', 'content' => 'Page4', ], ], ], ], ], ); $expected = << HTML; $this->assertEqualsWithoutLE($expected, $out); } public function testForms() { Dropdown::$counter = 0; $form = <<
HTML; $out = Dropdown::widget([ 'items' => [ $form, '-', [ 'label' => 'New around here? Sign up', 'url' => '#', ], [ 'label' => 'Forgot password?', 'url' => '#', ], ], ]); $expected = <<
New around here? Sign up Forgot password? HTML; $this->assertEqualsWithoutLE($expected, $out); } }