Skip to content

Commit b6c2e92

Browse files
committed
adding unit tests
1 parent f07328c commit b6c2e92

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/Unit/CrudPanel/CrudPanelButtonsTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,22 @@ public function testRemoveAllButtonsFromUnknownStack()
245245
$this->assertEquals(count($this->defaultButtonNames), count($this->crudPanel->buttons()));
246246
}
247247

248+
public function testReorderButtons() {
249+
$this->crudPanel->addButton('line', 'update', 'view', 'crud::buttons.update', 'end');
250+
$this->crudPanel->addButton('line', 'show', 'view', 'crud::buttons.show', 'end');
251+
$this->crudPanel->addButton('line', 'test', 'view', 'crud::buttons.update', 'end');
252+
253+
$this->crudPanel->reorderButtons('line', ['show', 'test']);
254+
255+
$this->assertEquals(['show', 'test', 'update'], $this->crudPanel->buttons()->pluck('name')->toArray());
256+
}
257+
248258
private function getButtonByName($name)
249259
{
250260
return $this->crudPanel->buttons()->first(function ($value) use ($name) {
251261
return $value->name == $name;
252262
});
253263
}
264+
265+
254266
}

0 commit comments

Comments
 (0)