-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Atk4\Ui\Demos; | ||
|
||
use Atk4\Ui\App; | ||
use Atk4\Ui\Form; | ||
use Atk4\Ui\Header; | ||
use Atk4\Ui\Wizard; | ||
|
||
/** @var App $app */ | ||
require_once __DIR__ . '/../init-app.php'; | ||
|
||
$wizard = Wizard::addTo($app); | ||
|
||
$stepFx = static function (Wizard $wizard) { | ||
$form = Form::addTo($wizard); | ||
$form->addControl('city', [], ['required' => true]); | ||
$form->onSubmit(static function (Form $form) use ($wizard) { | ||
return $wizard->jsNext(); | ||
}); | ||
}; | ||
$wizard->addStep(['Step 1'], $stepFx); | ||
$wizard->addStep(['Step 2'], $stepFx); | ||
|
||
$wizard->addFinish(static function (Wizard $wizard) { | ||
Header::addTo($wizard, ['Wizard completed']); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Feature: Wizard | ||
|
||
Scenario: test form submit | ||
Given I am on "_unit-test/wizard.php" | ||
Then I check if text in "//div.ui.two.steps//div.ui.step.active" match text "Step 1" | ||
Then I should not see "Must not be empty" | ||
When I click using selector "//a[text()='Next']" | ||
Then I should see "Must not be empty" | ||
When I fill in "city" with "Prague" | ||
When I click using selector "//a[text()='Next']" | ||
Then I check if text in "//div.ui.two.steps//div.ui.step.active" match text "Step 2" | ||
Then I should not see "Must not be empty" | ||
When I click using selector "//a[text()='Finish']" | ||
Then I should see "Must not be empty" | ||
When I fill in "city" with "London" | ||
Then I should not see "Wizard completed" | ||
When I click using selector "//a[text()='Finish']" | ||
Then I should see "Wizard completed" |