Skip to content

Commit

Permalink
simplify/fix Behat
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Mar 29, 2024
1 parent fec1793 commit 3dfe1b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
11 changes: 4 additions & 7 deletions demos/_unit-test/grid-rowclick.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Atk4\Ui\Js\JsExpression;
use Atk4\Ui\Js\JsFunction;
use Atk4\Ui\Js\JsToast;
use Atk4\Ui\Js\Jquery;
use Atk4\Ui\Message;
use Atk4\Ui\Table;
use Atk4\Ui\View;
Expand Down Expand Up @@ -40,13 +41,9 @@

$sel = $grid->addSelection();

$grid->menu->addItem('Show Selection')->on(
'click',
static function ($f, $ids) {
return new JsToast('Selected: ' . $ids . '#');
},
[$sel->jsChecked()]
);
$grid->addBulkAction('Show selected', static function (Jquery $j, array $ids) use ($grid) {
return new JsToast('Selected: ' . implode(', ', array_map(static fn ($id) => $grid->getApp()->uiPersistence->typecastSaveField($grid->model->getIdField(), $id), $ids)) . '#');
});

// emulate navigate for <a> for Behat
// TODO emulate for all tests automatically in our Atk4\Ui\Behat\Context
Expand Down
10 changes: 5 additions & 5 deletions tests-behat/grid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ Feature: Grid

Scenario: master checkbox
Given I am on "_unit-test/grid-rowclick.php"
When I press button "Show Selection"
When I press button "Show selected"
Then Toast display should contain text "Selected: #"
When I click using selector "//tr[1]//div.ui.child.checkbox"
Then I press button "Show Selection"
Then I press button "Show selected"
Then Toast display should contain text "Selected: 1#"
When I click using selector "//tr//div.ui.master.checkbox"
Then I press button "Show Selection"
Then Toast display should contain text "Selected: 1,2,3,4,5#"
Then I press button "Show selected"
Then Toast display should contain text "Selected: 1, 2, 3, 4, 5#"
When I click using selector "//tr//div.ui.master.checkbox"
Then I press button "Show Selection"
Then I press button "Show selected"
Then Toast display should contain text "Selected: #"

Scenario: popup column header
Expand Down

0 comments on commit 3dfe1b5

Please sign in to comment.