@@ 149-161 (lines=13) @@ | ||
146 | } |
|
147 | ||
148 | /** @test */ |
|
149 | public function it_can_make_a_simple_url_menu_item() |
|
150 | { |
|
151 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
|
152 | $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
153 | $sub->url('settings/account', 'Account'); |
|
154 | }); |
|
155 | $children = $menuItem->getChilds()[0]->getChilds(); |
|
156 | ||
157 | $this->assertCount(1, $children); |
|
158 | $childMenuItem = array_first($children); |
|
159 | $this->assertEquals('settings/account', $childMenuItem->url); |
|
160 | $this->assertEquals('Account', $childMenuItem->title); |
|
161 | } |
|
162 | ||
163 | /** @test */ |
|
164 | public function it_can_make_a_url_menu_item() |
|
@@ 181-194 (lines=14) @@ | ||
178 | } |
|
179 | ||
180 | /** @test */ |
|
181 | public function it_can_add_a_menu_item_divider() |
|
182 | { |
|
183 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
|
184 | $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
185 | $sub->url('settings/account', 'Account'); |
|
186 | $sub->divider(); |
|
187 | }); |
|
188 | ||
189 | $children = $menuItem->getChilds()[0]->getChilds(); |
|
190 | ||
191 | $this->assertCount(2, $children); |
|
192 | $dividerMenuItem = $children[1]; |
|
193 | $this->assertEquals('divider', $dividerMenuItem->name); |
|
194 | } |
|
195 | ||
196 | /** @test */ |
|
197 | public function it_can_add_a_header_menu_item() |
|
@@ 197-211 (lines=15) @@ | ||
194 | } |
|
195 | ||
196 | /** @test */ |
|
197 | public function it_can_add_a_header_menu_item() |
|
198 | { |
|
199 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
|
200 | $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
201 | $sub->header('User Stuff'); |
|
202 | $sub->url('settings/account', 'Account'); |
|
203 | }); |
|
204 | ||
205 | $children = $menuItem->getChilds()[0]->getChilds(); |
|
206 | ||
207 | $this->assertCount(2, $children); |
|
208 | $headerItem = $children[0]; |
|
209 | $this->assertEquals('header', $headerItem->name); |
|
210 | $this->assertEquals('User Stuff', $headerItem->title); |
|
211 | } |
|
212 | ||
213 | /** @test */ |
|
214 | public function it_can_get_the_correct_url_for_url_type() |