diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml
index 9c579d8ed..7a657ee70 100644
--- a/.github/workflows/static-analysis.yml
+++ b/.github/workflows/static-analysis.yml
@@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
- php-version: 8.1
+ php-version: 8.2
coverage: none
- run: composer install --no-progress --prefer-dist
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 519de812f..384001663 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- php: ['8.1', '8.2', '8.3', '8.4', '8.5']
+ php: ['8.2', '8.3', '8.4', '8.5']
fail-fast: false
@@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
- php-version: 8.1
+ php-version: 8.2
coverage: none
- run: composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable
@@ -49,7 +49,7 @@ jobs:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
- php-version: 8.1
+ php-version: 8.2
coverage: none
- run: composer install --no-progress --prefer-dist
diff --git a/composer.json b/composer.json
index 6a343bb3a..c9967f703 100644
--- a/composer.json
+++ b/composer.json
@@ -15,21 +15,21 @@
}
],
"require": {
- "php": "8.1 - 8.5",
- "nette/component-model": "^3.1",
+ "php": "8.2 - 8.5",
+ "nette/component-model": "^3.2",
"nette/http": "^3.3",
- "nette/utils": "^4.0.4"
+ "nette/utils": "^4.0.10"
},
"require-dev": {
- "nette/application": "^3.0",
- "nette/di": "^3.0",
+ "nette/application": "^3.3",
+ "nette/di": "^3.2",
"nette/tester": "^2.5.2",
- "latte/latte": "^2.10.2 || ^3.0.12",
- "tracy/tracy": "^2.9",
+ "latte/latte": "^3.1",
+ "tracy/tracy": "^2.11",
"phpstan/phpstan-nette": "^2.0@stable"
},
"conflict": {
- "latte/latte": ">=3.0.0 <3.0.12 || >=3.2"
+ "latte/latte": "<3.1 || >=3.2"
},
"suggest": {
"ext-intl": "to use date/time controls"
@@ -47,7 +47,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "3.2-dev"
+ "dev-master": "4.0-dev"
}
}
}
diff --git a/readme.md b/readme.md
index ebcd0fd44..cd6f8a895 100644
--- a/readme.md
+++ b/readme.md
@@ -2,8 +2,8 @@ Nette Forms: greatly facilitates web forms
==========================================
[](https://packagist.org/packages/nette/forms)
-[](https://github.com/nette/forms/actions)
-[](https://coveralls.io/github/nette/forms?branch=v3.2)
+[](https://github.com/nette/forms/actions)
+[](https://coveralls.io/github/nette/forms?branch=master)
[](https://github.com/nette/forms/releases)
[](https://github.com/nette/forms/blob/master/license.md)
diff --git a/rollup.config.js b/rollup.config.js
index 8a3697543..95ba912a3 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -34,21 +34,21 @@ function spaces2tabs() {
export default [
- {
+ { // TODO: consider the possibility of cutting off the UMD versions completely due to collision
input: 'src/assets/index.umd.ts',
output: [
{
format: 'umd',
name: 'Nette',
- dir: 'src/assets',
- entryFileNames: 'netteForms.js',
+ dir: 'src/assets/dist',
+ entryFileNames: 'nette-forms.umd.js',
generatedCode: 'es2015',
},
{
format: 'umd',
name: 'Nette',
- dir: 'src/assets',
- entryFileNames: 'netteForms.min.js',
+ dir: 'src/assets/dist',
+ entryFileNames: 'nette-forms.umd.min.js',
generatedCode: 'es2015',
plugins: [
terser(),
@@ -65,9 +65,36 @@ export default [
},
{
- input: 'src/assets/index.umd.ts',
+ input: 'src/assets/index.esm.ts',
+ output: [
+ {
+ format: 'es',
+ dir: 'src/assets/dist',
+ entryFileNames: 'nette-forms.esm.js',
+ generatedCode: 'es2015',
+ },
+ {
+ format: 'es',
+ dir: 'src/assets/dist',
+ entryFileNames: 'nette-forms.esm.min.js',
+ generatedCode: 'es2015',
+ plugins: [
+ terser(),
+ ],
+ },
+ ],
+ plugins: [
+ json(),
+ nodeResolve(),
+ typescript(),
+ spaces2tabs(),
+ ],
+ },
+
+ {
+ input: 'src/assets/index.esm.ts',
output: [{
- file: 'src/assets/netteForms.d.ts',
+ file: 'src/assets/dist/nette-forms.d.ts',
format: 'es',
}],
plugins: [
diff --git a/src/Bridges/FormsLatte/FormMacros.php b/src/Bridges/FormsLatte/FormMacros.php
deleted file mode 100644
index 18c889ad2..000000000
--- a/src/Bridges/FormsLatte/FormMacros.php
+++ /dev/null
@@ -1,330 +0,0 @@
-addMacro('form', [$me, 'macroForm'], 'echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack));');
- $me->addMacro('formContext', [$me, 'macroFormContext'], 'array_pop($this->global->formsStack);');
- $me->addMacro('formContainer', [$me, 'macroFormContainer'], 'array_pop($this->global->formsStack); $formContainer = end($this->global->formsStack)');
- $me->addMacro('label', [$me, 'macroLabel'], [$me, 'macroLabelEnd'], null, self::AUTO_EMPTY);
- $me->addMacro('input', [$me, 'macroInput']);
- $me->addMacro('name', [$me, 'macroName'], [$me, 'macroNameEnd'], [$me, 'macroNameAttr']);
- $me->addMacro('inputError', [$me, 'macroInputError']);
- $me->addMacro('formPrint', [$me, 'macroFormPrint']);
- $me->addMacro('formClassPrint', [$me, 'macroFormPrint']);
- }
-
-
- /********************* macros ****************d*g**/
-
-
- /**
- * {form ...}
- */
- public function macroForm(MacroNode $node, PhpWriter $writer)
- {
- if ($node->modifiers) {
- throw new CompileException('Modifiers are not allowed in ' . $node->getNotation());
- }
-
- if ($node->prefix) {
- throw new CompileException('Did you mean
' . $ʟ_tag;
+ echo ''),
+);
diff --git a/tests/Forms.Latte3/n-name.input.phpt b/tests/Forms.Latte/n-name.input.phpt
similarity index 53%
rename from tests/Forms.Latte3/n-name.input.phpt
rename to tests/Forms.Latte/n-name.input.phpt
index 0572ddb36..164845451 100644
--- a/tests/Forms.Latte3/n-name.input.phpt
+++ b/tests/Forms.Latte/n-name.input.phpt
@@ -7,22 +7,18 @@ use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
-if (version_compare(Latte\Engine::VERSION, '3', '<')) {
- Tester\Environment::skip('Test for Latte 3');
-}
-
$latte = new Latte\Engine;
$latte->setLoader(new Latte\Loaders\StringLoader);
$latte->addExtension(new FormsExtension);
Assert::match(
- '%A%echo ($ʟ_elem = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart())->attributes() %A%',
+ '%A%echo ($ʟ_elem = $this->global->forms->item(\'foo\')->getControlPart())->attributes() %A%',
$latte->compile(''),
);
Assert::match(
- '%A%echo ($ʟ_elem = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'\'))->attributes() %A%',
+ '%A%echo ($ʟ_elem = $this->global->forms->item(\'foo\')->getControlPart(\'\'))->attributes() %A%',
$latte->compile(''),
);
@@ -33,11 +29,11 @@ Assert::exception(
);
Assert::match(
- '%A%echo ($ʟ_elem = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'x\'))->attributes() %A%',
+ '%A%echo ($ʟ_elem = $this->global->forms->item(\'foo\')->getControlPart(\'x\'))->attributes() %A%',
$latte->compile(''),
);
Assert::match(
- '%A%echo ($ʟ_elem = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'x\'))->attributes() %A%',
+ '%A%echo ($ʟ_elem = $this->global->forms->item(\'foo\')->getControlPart(\'x\'))->attributes() %A%',
$latte->compile(''),
);
diff --git a/tests/Forms.Latte2/templates/forms.button.latte b/tests/Forms.Latte/templates/forms.button.latte
similarity index 100%
rename from tests/Forms.Latte2/templates/forms.button.latte
rename to tests/Forms.Latte/templates/forms.button.latte
diff --git a/tests/Forms.Latte2/templates/forms.formContainer.latte b/tests/Forms.Latte/templates/forms.formContainer.latte
similarity index 100%
rename from tests/Forms.Latte2/templates/forms.formContainer.latte
rename to tests/Forms.Latte/templates/forms.formContainer.latte
diff --git a/tests/Forms.Latte2/templates/forms.get.latte b/tests/Forms.Latte/templates/forms.get.latte
similarity index 100%
rename from tests/Forms.Latte2/templates/forms.get.latte
rename to tests/Forms.Latte/templates/forms.get.latte
diff --git a/tests/Forms.Latte3/templates/forms.latte b/tests/Forms.Latte/templates/forms.latte
similarity index 95%
rename from tests/Forms.Latte3/templates/forms.latte
rename to tests/Forms.Latte/templates/forms.latte
index 9cb0a42ac..2634c63f5 100644
--- a/tests/Forms.Latte3/templates/forms.latte
+++ b/tests/Forms.Latte/templates/forms.latte
@@ -75,9 +75,3 @@
{/form}
-
-
-{formContext myForm}
-
-
-{/formContext myForm}
diff --git a/tests/Forms.Latte/{input}.phpt b/tests/Forms.Latte/{input}.phpt
new file mode 100644
index 000000000..02b236220
--- /dev/null
+++ b/tests/Forms.Latte/{input}.phpt
@@ -0,0 +1,69 @@
+setLoader(new Latte\Loaders\StringLoader);
+$latte->addExtension(new FormsExtension);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControl() %A%',
+ $latte->compile('{input foo}'),
+);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControl()->addAttributes([\'class\' => \'foo\']) %A%',
+ $latte->compile('{input foo class => foo}'),
+);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControl()->addAttributes([\'class\' => \'foo\']) %A%',
+ $latte->compile('{input foo, class => foo}'),
+);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControlPart(\'\') %A%',
+ $latte->compile('{input foo:}'),
+);
+
+Assert::exception(
+ fn() => $latte->compile('{input foo: class => foo}'),
+ Latte\CompileException::class,
+ "Unexpected '=>', expecting end of tag in {input} (on line 1 at column 19)",
+);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControlPart(\'\') %A%',
+ $latte->compile('{input foo:,}'),
+);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControlPart(\'\')->addAttributes([\'class\' => \'foo\']) %A%',
+ $latte->compile('{input foo:, class => foo}'),
+);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControlPart(\'x\') %A%',
+ $latte->compile('{input foo:x}'),
+);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControlPart(\'x\')->addAttributes([\'class\' => \'foo\']) %A%',
+ $latte->compile('{input foo:x, class => foo}'),
+);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControlPart(\'x\') %A%',
+ $latte->compile('{input "foo":"x"}'),
+);
+
+Assert::match(
+ '%A%echo $this->global->forms->item(\'foo\')->getControlPart(\'x\') %A%',
+ $latte->compile('{input "foo" : "x"}'),
+);
diff --git a/tests/Forms.Latte/{label}.phpt b/tests/Forms.Latte/{label}.phpt
new file mode 100644
index 000000000..b09ceca04
--- /dev/null
+++ b/tests/Forms.Latte/{label}.phpt
@@ -0,0 +1,69 @@
+setLoader(new Latte\Loaders\StringLoader);
+$latte->addExtension(new FormsExtension);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabel()) %A%',
+ $latte->compile('{label foo /}'),
+);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabel())?->addAttributes([\'class\' => \'foo\']) %A%',
+ $latte->compile('{label foo class => foo /}'),
+);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabel())?->addAttributes([\'class\' => \'foo\']) %A%',
+ $latte->compile('{label foo, class => foo /}'),
+);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabelPart(\'\')) %A%',
+ $latte->compile('{label foo: /}'),
+);
+
+Assert::exception(
+ fn() => $latte->compile('{label foo: class => foo /}'),
+ Latte\CompileException::class,
+ "Unexpected '=>', expecting end of tag in {label} (on line 1 at column 19)",
+);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabelPart(\'\')) %A%',
+ $latte->compile('{label foo:, /}'),
+);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabelPart(\'\'))?->addAttributes([\'class\' => \'foo\']) %A%',
+ $latte->compile('{label foo:, class => foo /}'),
+);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabelPart(\'x\')) %A%',
+ $latte->compile('{label foo:x /}'),
+);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabelPart(\'x\'))?->addAttributes([\'class\' => \'foo\']) %A%',
+ $latte->compile('{label foo:x, class => foo /}'),
+);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabelPart(\'x\')) %A%',
+ $latte->compile('{label "foo":"x" /}'),
+);
+
+Assert::match(
+ '%A%echo ($ʟ_label = $this->global->forms->item(\'foo\')->getLabelPart(\'x\')) %A%',
+ $latte->compile('{label "foo" : "x" /}'),
+);
diff --git a/tests/Forms.Latte2/FormMacros.button.phpt b/tests/Forms.Latte2/FormMacros.button.phpt
deleted file mode 100644
index 549aedb31..000000000
--- a/tests/Forms.Latte2/FormMacros.button.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
-')) {
- Tester\Environment::skip('Test for Latte 2');
-}
-
-
-$form = new Form;
-$form->addSubmit('send', 'Sign in');
-
-$latte = new Latte\Engine;
-FormMacros::install($latte->getCompiler());
-$latte->addProvider('uiControl', ['myForm' => $form]);
-
-Assert::matchFile(
- __DIR__ . '/expected/FormMacros.button.php',
- $latte->compile(__DIR__ . '/templates/forms.button.latte'),
-);
-
-Assert::matchFile(
- __DIR__ . '/expected/FormMacros.button.html',
- $latte->renderToString(__DIR__ . '/templates/forms.button.latte'),
-);
diff --git a/tests/Forms.Latte2/FormMacros.error.phpt b/tests/Forms.Latte2/FormMacros.error.phpt
deleted file mode 100644
index 68dc2a5b0..000000000
--- a/tests/Forms.Latte2/FormMacros.error.phpt
+++ /dev/null
@@ -1,55 +0,0 @@
-')) {
- Tester\Environment::skip('Test for Latte 2');
-}
-
-
-$latte = new Latte\Engine;
-$latte->setLoader(new Latte\Loaders\StringLoader);
-FormMacros::install($latte->getCompiler());
-
-Assert::exception(function () use ($latte) {
- $latte->compile('');
-}, Latte\CompileException::class, 'Did you mean ');
-}, Latte\CompileException::class, 'Missing name in n:name');
-
-Assert::exception(function () use ($latte) {
- $latte->compile('');
-}, Latte\CompileException::class, 'Unknown attribute n:inner-name, use n:name attribute.');
-
-
-Assert::exception(function () use ($latte) {
- $latte->compile('{form /}');
-}, Latte\CompileException::class, 'Missing form name in {form}');
-
-Assert::exception(function () use ($latte) {
- $latte->compile('{formContainer /}');
-}, Latte\CompileException::class, 'Missing name in {formContainer}');
-
-
-Assert::exception(function () use ($latte) {
- $latte->compile('{label /}');
-}, Latte\CompileException::class, 'Missing name in {label}');
-
-Assert::exception(function () use ($latte) {
- $latte->compile('{input /}');
-}, Latte\CompileException::class, 'Missing name in {input}');
-
-Assert::exception(function () use ($latte) {
- $latte->compile('{name /}');
-}, Latte\CompileException::class, 'Unknown tag {name}, use n:name attribute.');
diff --git a/tests/Forms.Latte2/FormMacros.formContainer.phpt b/tests/Forms.Latte2/FormMacros.formContainer.phpt
deleted file mode 100644
index a2d93c6e0..000000000
--- a/tests/Forms.Latte2/FormMacros.formContainer.phpt
+++ /dev/null
@@ -1,55 +0,0 @@
-')) {
- Tester\Environment::skip('Test for Latte 2');
-}
-
-
-$form = new Form;
-$form->addText('input1', 'Input 1');
-
-$cont1 = $form->addContainer('cont1');
-$cont1->addText('input2', 'Input 2');
-$cont1->addText('input3', 'Input 3');
-
-$cont2 = $cont1->addContainer('cont2');
-$cont2->addCheckbox('input4', 'Input 4');
-$cont2->addCheckbox('input5', 'Input 5');
-$cont2->addCheckbox('input6', 'Input 6');
-
-$cont1->addText('input7', 'Input 7');
-
-$contItems = $form->addContainer('items');
-$items = [1, 3];
-foreach ($items as $item) {
- $contItem = $contItems->addContainer($item);
- $contItem->addText('input', 'Input');
-}
-
-$form->addSubmit('input8', 'Input 8');
-
-
-$latte = new Latte\Engine;
-FormMacros::install($latte->getCompiler());
-$latte->addProvider('uiControl', ['myForm' => $form]);
-
-Assert::matchFile(
- __DIR__ . '/expected/FormMacros.formContainer.php',
- $latte->compile(__DIR__ . '/templates/forms.formContainer.latte'),
-);
-Assert::matchFile(
- __DIR__ . '/expected/FormMacros.formContainer.html',
- $latte->renderToString(__DIR__ . '/templates/forms.formContainer.latte'),
-);
diff --git a/tests/Forms.Latte2/FormMacros.forms.phpt b/tests/Forms.Latte2/FormMacros.forms.phpt
deleted file mode 100644
index 6ff9a2b10..000000000
--- a/tests/Forms.Latte2/FormMacros.forms.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
-')) {
- Tester\Environment::skip('Test for Latte 2');
-}
-
-
-class MyControl extends Nette\Forms\Controls\BaseControl
-{
- public function getLabel($c = null)
- {
- return '';
- }
-
-
- public function getControl()
- {
- return '';
- }
-}
-
-
-$form = new Form;
-$form->getElementPrototype()->addClass('form-class');
-$form->addHidden('id');
-$form->addText('username', 'Username:'); // must have just one textfield to generate IE fix
-$form['username']->getControlPrototype()->addClass('control-class');
-$form->addRadioList('sex', 'Sex:', ['m' => 'male', 'f' => 'female']);
-$form->addSelect('select', null, ['m' => 'male', 'f' => 'female']);
-$form->addTextArea('area', null)->setValue('oneaddCheckbox('checkbox', 'Checkbox');
-$form->addCheckboxList('checklist', 'CheckboxList:', ['m' => 'male', 'f' => 'female']);
-$form->addSubmit('send', 'Sign in');
-$form['my'] = new MyControl;
-
-$latte = new Latte\Engine;
-FormMacros::install($latte->getCompiler());
-$latte->addProvider('uiControl', ['myForm' => $form]);
-
-$form['username']->addError('error');
-
-Assert::matchFile(
- __DIR__ . '/expected/FormMacros.forms.php',
- $latte->compile(__DIR__ . '/templates/forms.latte'),
-);
-Assert::matchFile(
- __DIR__ . '/expected/FormMacros.forms.html',
- $latte->renderToString(__DIR__ . '/templates/forms.latte'),
-);
diff --git a/tests/Forms.Latte2/FormMacros.get.phpt b/tests/Forms.Latte2/FormMacros.get.phpt
deleted file mode 100644
index cb74c5d93..000000000
--- a/tests/Forms.Latte2/FormMacros.get.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
-')) {
- Tester\Environment::skip('Test for Latte 2');
-}
-
-
-$form = new Form;
-$form->setMethod('get');
-$form->setAction('?arg=val');
-$form->addSubmit('send', 'Sign in');
-
-$latte = new Latte\Engine;
-FormMacros::install($latte->getCompiler());
-$latte->addProvider('uiControl', ['myForm' => $form]);
-
-Assert::matchFile(
- __DIR__ . '/expected/FormMacros.get.php',
- $latte->compile(__DIR__ . '/templates/forms.get.latte'),
-);
-Assert::matchFile(
- __DIR__ . '/expected/FormMacros.get.html',
- $latte->renderToString(__DIR__ . '/templates/forms.get.latte'),
-);
diff --git a/tests/Forms.Latte2/expected/FormMacros.button.html b/tests/Forms.Latte2/expected/FormMacros.button.html
deleted file mode 100644
index 30763a37a..000000000
--- a/tests/Forms.Latte2/expected/FormMacros.button.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
\ No newline at end of file
diff --git a/tests/Forms.Latte2/expected/FormMacros.button.php b/tests/Forms.Latte2/expected/FormMacros.button.php
deleted file mode 100644
index 984e031a8..000000000
--- a/tests/Forms.Latte2/expected/FormMacros.button.php
+++ /dev/null
@@ -1,30 +0,0 @@
-global->formsStack[] = $this->global->uiControl["myForm"] /* line 1 */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '
-';
-%A%
diff --git a/tests/Forms.Latte2/expected/FormMacros.formContainer.html b/tests/Forms.Latte2/expected/FormMacros.formContainer.html
deleted file mode 100644
index 2e45cf0d6..000000000
--- a/tests/Forms.Latte2/expected/FormMacros.formContainer.html
+++ /dev/null
@@ -1,41 +0,0 @@
-
diff --git a/tests/Forms.Latte2/expected/FormMacros.formContainer.php b/tests/Forms.Latte2/expected/FormMacros.formContainer.php
deleted file mode 100644
index 8b33447ec..000000000
--- a/tests/Forms.Latte2/expected/FormMacros.formContainer.php
+++ /dev/null
@@ -1,101 +0,0 @@
-global->formsStack[] = $this->global->uiControl["myForm"];
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, []) /* line 1 */;
- echo '
-
-
- | ';
- if ($ʟ_label = end($this->global->formsStack)["input1"]->getLabel()) echo $ʟ_label;
- echo ' |
- ';
- echo end($this->global->formsStack)["input1"]->getControl() /* line 5 */;
- echo ' |
-
-';
- $this->global->formsStack[] = $formContainer = end($this->global->formsStack)["cont1"] /* line 7 */;
- echo '
- | ';
- if ($ʟ_label = end($this->global->formsStack)["input2"]->getLabel()) echo $ʟ_label;
- echo ' |
- ';
- echo end($this->global->formsStack)["input2"]->getControl() /* line 10 */;
- echo ' |
-
-
- | ';
- if ($ʟ_label = end($this->global->formsStack)["input3"]->getLabel()) echo $ʟ_label;
- echo ' |
- ';
- echo end($this->global->formsStack)["input3"]->getControl() /* line 14 */;
- echo ' |
-
-
- | Checkboxes |
-
-';
- $this->global->formsStack[] = $formContainer = end($this->global->formsStack)["cont2"] /* line 19 */;
- echo '
-';
- $iterations = 0;
- foreach ($formContainer->controls as $name => $field) /* line 19 */ {
- echo ' - ';
- $ʟ_input = $_input = is_object($ʟ_tmp = $field) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp];
- echo $ʟ_input->getControl() /* line 20 */;
- echo '
-';
- $iterations++;
- }
- echo '
-';
- array_pop($this->global->formsStack);
- $formContainer = end($this->global->formsStack);
- echo ' |
-
-
- | ';
- if ($ʟ_label = end($this->global->formsStack)["input7"]->getLabel()) echo $ʟ_label;
- echo ' |
- ';
- echo end($this->global->formsStack)["input7"]->getControl() /* line 26 */;
- echo ' |
-
-';
- array_pop($this->global->formsStack);
- $formContainer = end($this->global->formsStack);
- $this->global->formsStack[] = $formContainer = end($this->global->formsStack)["items"] /* line 29 */;
- echo '
- | Items |
-
-';
- $items = array(1, 2, 3) /* line 33 */;
- $iterations = 0;
- foreach ($items as $item) /* line 34 */ {
- if (!isset($formContainer[$item])) /* line 35 */ continue;
- $this->global->formsStack[] = $formContainer = is_object($ʟ_tmp = $item) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp] /* line 36 */;
- echo ' ';
- echo end($this->global->formsStack)["input"]->getControl() /* line 37 */;
- echo "\n";
- array_pop($this->global->formsStack);
- $formContainer = end($this->global->formsStack);
- $iterations++;
- }
- echo ' |
-
-';
- array_pop($this->global->formsStack);
- $formContainer = end($this->global->formsStack);
- echo '
- | ';
- if ($ʟ_label = end($this->global->formsStack)["input8"]->getLabel()) echo $ʟ_label;
- echo ' |
- ';
- echo end($this->global->formsStack)["input8"]->getControl() /* line 45 */;
- echo ' |
-
-
-';
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack));
- echo "\n";
-%A%
diff --git a/tests/Forms.Latte2/expected/FormMacros.forms.html b/tests/Forms.Latte2/expected/FormMacros.forms.html
deleted file mode 100644
index 8dffbcaf1..000000000
--- a/tests/Forms.Latte2/expected/FormMacros.forms.html
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/Forms.Latte2/expected/FormMacros.forms.php b/tests/Forms.Latte2/expected/FormMacros.forms.php
deleted file mode 100644
index dda078042..000000000
--- a/tests/Forms.Latte2/expected/FormMacros.forms.php
+++ /dev/null
@@ -1,297 +0,0 @@
-global->formsStack[] = $this->global->uiControl["myForm"];
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, ['id' => 'myForm', 'class'=>"ajax"]) /* line 1 */;
- echo "\n";
- $iterations = 0;
- foreach (['id', 'username', 'select', 'area', 'send'] as $name) /* line 2 */ {
- echo ' ';
- $ʟ_input = is_object($ʟ_tmp = $name) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp];
- if ($ʟ_label = $ʟ_input->getLabel()) echo $ʟ_label;
- echo '
- ';
- $ʟ_input = $_input = is_object($ʟ_tmp = $name) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp];
- echo $ʟ_input->getControl()->addAttributes(['title' => 'Hello', 'size' => 10]) /* line 4 */;
- echo '
- ';
- echo LR\Filters::escapeHtmlText($ʟ_input->getError()) /* line 5 */;
- echo '
- ';
- $ʟ_input = is_object($ʟ_tmp = $name) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp];
- echo LR\Filters::escapeHtmlText($ʟ_input->getError()) /* line 6 */;
- echo '
-
-
-
- ';
- $ʟ_input = is_object($ʟ_tmp = $form[$name]) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp];
- if ($ʟ_label = $ʟ_input->getLabel()) echo $ʟ_label->addAttributes(['title' => 'hello'])->startTag();
- echo ' ';
- $ʟ_input = $_input = is_object($ʟ_tmp = $form[$name]) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp];
- echo $ʟ_input->getControl()->addAttributes(['title' => 'Hello', 'size' => 10]) /* line 10 */;
- echo ' ';
- if ($ʟ_label) echo $ʟ_label->endTag();
- echo '
- ';
- $ʟ_input = is_object($ʟ_tmp = $form[$name]) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp];
- echo LR\Filters::escapeHtmlText($ʟ_input->getError()) /* line 11 */;
- echo "\n";
- $iterations++;
- }
- echo '
- ';
- $ʟ_input = is_object($ʟ_tmp = $form['username']) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp];
- if ($ʟ_label = $ʟ_input->getLabel()) echo $ʟ_label;
- echo '
-
-
- global->formsStack)["username"];
- echo $ʟ_input->getControlPart()->addAttributes(['value' => null, 'type' => null, 'class' => null])->attributes() /* line 17 */;
- echo '>
-
-
-
- global->formsStack)[$ʟ_tmp];
- echo $ʟ_input->getControlPart()->attributes() /* line 21 */;
- echo '>
-
- ';
- if ($ʟ_label = end($this->global->formsStack)["my"]->getLabel()) echo $ʟ_label;
- echo end($this->global->formsStack)["my"]->getControl() /* line 23 */;
- echo "\n";
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack));
- echo '
-
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl["myForm"];
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, []) /* line 27 */;
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack));
- echo '
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl["myForm"];
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, []) /* line 29 */;
- echo "\n";
- $iterations = 0;
- foreach ($form['sex']->items as $key => $label) /* line 31 */ {
- echo ' ';
- if ($ʟ_label = end($this->global->formsStack)["sex"]->getLabelPart($key)) echo $ʟ_label->startTag();
- echo ' ';
- echo end($this->global->formsStack)["sex"]->getControlPart($key) /* line 32 */;
- echo ' ';
- echo LR\Filters::escapeHtmlText($label) /* line 32 */;
- if ($ʟ_label) echo $ʟ_label->endTag();
- echo '
-
-';
- $iterations++;
- }
- echo '
-
-
-
-
-';
- if ($ʟ_label = end($this->global->formsStack)["checkbox"]->getLabelPart("")) echo $ʟ_label->startTag();
- echo ' ';
- echo end($this->global->formsStack)["checkbox"]->getControlPart("") /* line 41 */;
- echo ' Label';
- if ($ʟ_label) echo $ʟ_label->endTag();
- echo '
-
-
-
-
-
-
-';
- $iterations = 0;
- foreach ($form['checklist']->items as $key => $label) /* line 49 */ {
- echo ' ';
- if ($ʟ_label = end($this->global->formsStack)["checklist"]->getLabelPart($key)) echo $ʟ_label->startTag();
- echo ' ';
- echo end($this->global->formsStack)["checklist"]->getControlPart($key) /* line 50 */;
- echo ' ';
- echo LR\Filters::escapeHtmlText($label) /* line 50 */;
- if ($ʟ_label) echo $ʟ_label->endTag();
- echo '
-
-';
- $iterations++;
- }
- echo '
-
-
-
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl["myForm"] /* line 58 */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- if (1) /* line 58 */ {
- echo '
-';
- }
- echo '
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl["myForm"] /* line 63 */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '
-
-
-';
- $form = $this->global->formsStack[] = is_object($ʟ_tmp = $this->global->uiControl['myForm']) ? $ʟ_tmp : $this->global->uiControl[$ʟ_tmp] /* line 68 */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '
-
-
-
-
-
-
-
-
-
-';
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack));
- echo '
-
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl["myForm"] /* line 83 */;
- echo '
-global->formsStack)["username"];
- echo $ʟ_input->getControlPart()->attributes() /* line 85 */;
- echo '>
-';
- array_pop($this->global->formsStack);
-%A%
diff --git a/tests/Forms.Latte2/expected/FormMacros.get.html b/tests/Forms.Latte2/expected/FormMacros.get.html
deleted file mode 100644
index e37282817..000000000
--- a/tests/Forms.Latte2/expected/FormMacros.get.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/tests/Forms.Latte2/expected/FormMacros.get.php b/tests/Forms.Latte2/expected/FormMacros.get.php
deleted file mode 100644
index ae17372cd..000000000
--- a/tests/Forms.Latte2/expected/FormMacros.get.php
+++ /dev/null
@@ -1,19 +0,0 @@
-global->formsStack[] = $this->global->uiControl["myForm"];
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, []) /* line 1 */;
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack));
- echo '
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl["myForm"] /* line 3 */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '
-';
-%A%
diff --git a/tests/Forms.Latte2/templates/forms.latte b/tests/Forms.Latte2/templates/forms.latte
deleted file mode 100644
index adf5a60c8..000000000
--- a/tests/Forms.Latte2/templates/forms.latte
+++ /dev/null
@@ -1,86 +0,0 @@
-{form myForm id => myForm, class=>"ajax"}
- {foreach [id, username, select, area, send] as $name}
- {label $name /}
- {input $name title => Hello, size => 10}
- {inputError}
- {inputError $name}
-
-
-
- {label $form[$name] title => hello} {input $form[$name] title => Hello, size => 10} {/label}
- {inputError $form[$name]}
- {/foreach}
-
- {label $form[username] /}
-
-
-
-
-
-
-
-
- {label my/}{input my}
-{/form myForm}
-
-
-{form myForm /}
-
-{form myForm}
-{* partial rendering of RadioList *}
-{foreach $form[sex]->items as $key => $label}
- {label sex:$key} {input sex:$key} {$label}{/label}
-
-{/foreach}
-
-
-
-
-
-{* partial rendering of Checkbox *}
-{label checkbox:} {input checkbox:} Label{/label}
-
-
-
-
-
-
-{* partial rendering of CheckboxList *}
-{foreach $form[checklist]->items as $key => $label}
- {label checklist:$key} {input checklist:$key} {$label}{/label}
-
-{/foreach}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{/form}
-
-
-{formContext myForm}
-
-
-{/formContext myForm}
diff --git a/tests/Forms.Latte3/expected/forms.button.php b/tests/Forms.Latte3/expected/forms.button.php
deleted file mode 100644
index f997b96af..000000000
--- a/tests/Forms.Latte3/expected/forms.button.php
+++ /dev/null
@@ -1,28 +0,0 @@
-global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '
-';
- array_pop($this->global->formsStack);
-%A%
diff --git a/tests/Forms.Latte3/expected/forms.formContainer.php b/tests/Forms.Latte3/expected/forms.formContainer.php
deleted file mode 100644
index e3e921c11..000000000
--- a/tests/Forms.Latte3/expected/forms.formContainer.php
+++ /dev/null
@@ -1,103 +0,0 @@
-global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, []) /* %a% */;
- echo '
-
-
- | ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item('input1', $this->global)->getLabel()) /* %a% */;
- echo ' |
- ';
- echo Nette\Bridges\FormsLatte\Runtime::item('input1', $this->global)->getControl() /* %a% */;
- echo ' |
-
-';
- $this->global->formsStack[] = $formContainer = Nette\Bridges\FormsLatte\Runtime::item('cont1', $this->global) /* %a% */;
- echo '
- | ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item('input2', $this->global)->getLabel()) /* %a% */;
- echo ' |
- ';
- echo Nette\Bridges\FormsLatte\Runtime::item('input2', $this->global)->getControl() /* %a% */;
- echo ' |
-
-
- | ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item('input3', $this->global)->getLabel()) /* %a% */;
- echo ' |
- ';
- echo Nette\Bridges\FormsLatte\Runtime::item('input3', $this->global)->getControl() /* %a% */;
- echo ' |
-
-
- | Checkboxes |
-
-';
- $this->global->formsStack[] = $formContainer = Nette\Bridges\FormsLatte\Runtime::item('cont2', $this->global) /* %a% */;
- echo '
-';
- foreach ($formContainer->controls as $name => $field) /* %a% */ {
- echo ' - ';
- echo Nette\Bridges\FormsLatte\Runtime::item($field, $this->global)->getControl() /* %a% */;
- echo '
-';
-
- }
-
- echo '
-';
- array_pop($this->global->formsStack);
- $formContainer = end($this->global->formsStack);
-
- echo ' |
-
-
- | ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item('input7', $this->global)->getLabel()) /* %a% */;
- echo ' |
- ';
- echo Nette\Bridges\FormsLatte\Runtime::item('input7', $this->global)->getControl() /* %a% */;
- echo ' |
-
-';
- array_pop($this->global->formsStack);
- $formContainer = end($this->global->formsStack);
-
- $this->global->formsStack[] = $formContainer = Nette\Bridges\FormsLatte\Runtime::item('items', $this->global) /* %a% */;
- echo '
- | Items |
-
-';
- $items = [1, 2, 3] /* %a% */;
- foreach ($items as $item) /* %a% */ {
- if (!isset($formContainer[$item])) /* %a% */ continue;
- $this->global->formsStack[] = $formContainer = Nette\Bridges\FormsLatte\Runtime::item($item, $this->global) /* %a% */;
- echo ' ';
- echo Nette\Bridges\FormsLatte\Runtime::item('input', $this->global)->getControl() /* %a% */;
- echo "\n";
- array_pop($this->global->formsStack);
- $formContainer = end($this->global->formsStack);
-
-
- }
-
- echo ' |
-
-';
- array_pop($this->global->formsStack);
- $formContainer = end($this->global->formsStack);
-
- echo '
- | ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item('input8', $this->global)->getLabel()) /* %a% */;
- echo ' |
- ';
- echo Nette\Bridges\FormsLatte\Runtime::item('input8', $this->global)->getControl() /* %a% */;
- echo ' |
-
-
-';
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack)) /* %a% */;
-%A%
diff --git a/tests/Forms.Latte3/expected/forms.get.php b/tests/Forms.Latte3/expected/forms.get.php
deleted file mode 100644
index 810f9b694..000000000
--- a/tests/Forms.Latte3/expected/forms.get.php
+++ /dev/null
@@ -1,21 +0,0 @@
-global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, []) /* %a% */;
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack)) /* %a% */;
-
- echo '
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '
-';
- array_pop($this->global->formsStack);
-%A%
diff --git a/tests/Forms.Latte3/expected/forms.php b/tests/Forms.Latte3/expected/forms.php
deleted file mode 100644
index 07b46a1e4..000000000
--- a/tests/Forms.Latte3/expected/forms.php
+++ /dev/null
@@ -1,263 +0,0 @@
-global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, ['id' => 'myForm', 'class' => 'ajax']) /* %a% */;
- echo "\n";
- foreach (['id', 'username', 'select', 'area', 'send'] as $name) /* %a% */ {
- echo ' ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item($name, $this->global)->getLabel()) /* %a% */;
- echo '
- ';
- echo Nette\Bridges\FormsLatte\Runtime::item($name, $this->global)->getControl()->addAttributes(['title' => 'Hello', 'size' => 10]) /* %a% */;
- echo '
- ';
- echo LR\%a%::escape%a%(Nette\Bridges\FormsLatte\Runtime::item($name, $this->global)->getError()) /* %a% */;
- echo '
-
-
-
- ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item($form[$name], $this->global)->getLabel())?->addAttributes(['title' => 'hello'])?->startTag() /* %a% */;
- echo ' ';
- echo Nette\Bridges\FormsLatte\Runtime::item($form[$name], $this->global)->getControl()->addAttributes(['title' => 'Hello', 'size' => 10]) /* %a% */;
- echo ' ';
- echo $ʟ_label?->endTag() /* %a% */;
- echo '
- ';
- echo LR\%a%::escape%a%(Nette\Bridges\FormsLatte\Runtime::item($form[$name], $this->global)->getError()) /* %a% */;
- echo "\n";
-
- }
-
- echo '
- ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item($form['username'], $this->global)->getLabel()) /* %a% */;
- echo '
-
-
- global)->getControlPart())->addAttributes(['value' => null, 'type' => null, 'class' => null])->attributes() /* %a% */;
- echo '>
-
-
-
- global)->getControlPart())->attributes() /* %a% */;
- echo '>
-
- ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item('my', $this->global)->getLabel()) /* %a% */;
- echo Nette\Bridges\FormsLatte\Runtime::item('my', $this->global)->getControl() /* %a% */;
- echo "\n";
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack)) /* %a% */;
-
- echo '
-
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, []) /* %a% */;
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack)) /* %a% */;
-
- echo '
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, []) /* %a% */;
- echo "\n";
- foreach ($form['sex']->items as $key => $label) /* %a% */ {
- echo ' ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item('sex', $this->global)->getLabelPart($key))?->startTag() /* %a% */;
- echo ' ';
- echo Nette\Bridges\FormsLatte\Runtime::item('sex', $this->global)->getControlPart($key) /* %a% */;
- echo ' ';
- echo LR\%a%::escape%a%($label) /* %a% */;
- echo $ʟ_label?->endTag() /* %a% */;
- echo '
-
-
-';
-
- }
-
- echo '
-
-
-global)->getControlPart("{$key}"))->attributes() /* %a% */;
- echo '>
-
-
-';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item('checkbox', $this->global)->getLabelPart(''))?->startTag() /* %a% */;
- echo ' ';
- echo Nette\Bridges\FormsLatte\Runtime::item('checkbox', $this->global)->getControlPart('') /* %a% */;
- echo ' Label';
- echo $ʟ_label?->endTag() /* %a% */;
- echo '
-
-
-
-
-
-
-';
- foreach ($form['checklist']->items as $key => $label) /* %a% */ {
- echo ' ';
- echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item('checklist', $this->global)->getLabelPart($key))?->startTag() /* %a% */;
- echo ' ';
- echo Nette\Bridges\FormsLatte\Runtime::item('checklist', $this->global)->getControlPart($key) /* %a% */;
- echo ' ';
- echo LR\%a%::escape%a%($label) /* %a% */;
- echo $ʟ_label?->endTag() /* %a% */;
- echo '
-
-
-';
-
- }
-
- echo '
-
-
-
-
-';
- if (1) /* %a% */ {
- $form = $this->global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '
-';
- array_pop($this->global->formsStack);
- }
- echo '
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '
-';
- array_pop($this->global->formsStack);
- echo '
-
-
-
-
-
-
-
-
-';
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack)) /* %a% */;
-
- echo '
-
-
-';
- $form = $this->global->formsStack[] = $this->global->uiControl['myForm'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '
-
-global)->getControlPart())->attributes() /* %a% */;
- echo '>
-';
- array_pop($this->global->formsStack) /* %a% */;
-%A%
diff --git a/tests/Forms.Latte3/n-name.form.phpt b/tests/Forms.Latte3/n-name.form.phpt
deleted file mode 100644
index 1e62afa48..000000000
--- a/tests/Forms.Latte3/n-name.form.phpt
+++ /dev/null
@@ -1,53 +0,0 @@
-setLoader(new Latte\Loaders\StringLoader);
-$latte->addExtension(new FormsExtension);
-
-Assert::match(
- <<<'XX'
- %A%
- $form = $this->global->formsStack[] = $this->global->uiControl['foo'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- echo '';
- array_pop($this->global->formsStack);
- %A%
- XX,
- $latte->compile(''),
-);
-
-
-Assert::match(
- <<<'XX'
- %A%
- $form = $this->global->formsStack[] = $this->global->uiControl['foo'] /* %a% */;
- Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
- %a%
- if (0) /* %a% */ {
- %A%
- echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin(end($this->global->formsStack), [], false) /* %a% */;
- echo '>';
- %A%
- echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(end($this->global->formsStack), false) /* %a% */;
- %a%
- array_pop($this->global->formsStack);
- %A%
- XX,
- $latte->compile(''),
-);
diff --git a/tests/Forms.Latte3/templates/forms.button.latte b/tests/Forms.Latte3/templates/forms.button.latte
deleted file mode 100644
index 8e9969b37..000000000
--- a/tests/Forms.Latte3/templates/forms.button.latte
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/tests/Forms.Latte3/templates/forms.formContainer.latte b/tests/Forms.Latte3/templates/forms.formContainer.latte
deleted file mode 100644
index cbc69cbb9..000000000
--- a/tests/Forms.Latte3/templates/forms.formContainer.latte
+++ /dev/null
@@ -1,48 +0,0 @@
-{form myForm}
-
-
- | {label input1 /} |
- {input input1} |
-
- {formContainer cont1}
-
- | {label input2 /} |
- {input input2} |
-
-
- | {label input3 /} |
- {input input3} |
-
-
- | Checkboxes |
-
-
- - {input $field}
-
- |
-
-
- | {label input7 /} |
- {input input7} |
-
- {/formContainer}
- {formContainer items}
-
- | Items |
-
- {var $items = array(1, 2, 3)}
- {foreach $items as $item}
- {continueIf !isset($formContainer[$item])}
- {formContainer $item}
- {input input}
- {/formContainer}
- {/foreach}
- |
-
- {/formContainer}
-
- | {label input8 /} |
- {input input8} |
-
-
-{/form}
diff --git a/tests/Forms.Latte3/templates/forms.get.latte b/tests/Forms.Latte3/templates/forms.get.latte
deleted file mode 100644
index c514a0202..000000000
--- a/tests/Forms.Latte3/templates/forms.get.latte
+++ /dev/null
@@ -1,4 +0,0 @@
-{form myForm /}
-
-
diff --git a/tests/Forms.Latte3/{input}.phpt b/tests/Forms.Latte3/{input}.phpt
deleted file mode 100644
index 798c091ce..000000000
--- a/tests/Forms.Latte3/{input}.phpt
+++ /dev/null
@@ -1,73 +0,0 @@
-setLoader(new Latte\Loaders\StringLoader);
-$latte->addExtension(new FormsExtension);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControl() %A%',
- $latte->compile('{input foo}'),
-);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControl()->addAttributes([\'class\' => \'foo\']) %A%',
- $latte->compile('{input foo class => foo}'),
-);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControl()->addAttributes([\'class\' => \'foo\']) %A%',
- $latte->compile('{input foo, class => foo}'),
-);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'\') %A%',
- $latte->compile('{input foo:}'),
-);
-
-Assert::exception(
- fn() => $latte->compile('{input foo: class => foo}'),
- Latte\CompileException::class,
- "Unexpected '=>', expecting end of tag in {input} (on line 1 at column 19)",
-);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'\') %A%',
- $latte->compile('{input foo:,}'),
-);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'\')->addAttributes([\'class\' => \'foo\']) %A%',
- $latte->compile('{input foo:, class => foo}'),
-);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'x\') %A%',
- $latte->compile('{input foo:x}'),
-);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'x\')->addAttributes([\'class\' => \'foo\']) %A%',
- $latte->compile('{input foo:x, class => foo}'),
-);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'x\') %A%',
- $latte->compile('{input "foo":"x"}'),
-);
-
-Assert::match(
- '%A%echo Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getControlPart(\'x\') %A%',
- $latte->compile('{input "foo" : "x"}'),
-);
diff --git a/tests/Forms.Latte3/{label}.phpt b/tests/Forms.Latte3/{label}.phpt
deleted file mode 100644
index a581a3eb3..000000000
--- a/tests/Forms.Latte3/{label}.phpt
+++ /dev/null
@@ -1,73 +0,0 @@
-setLoader(new Latte\Loaders\StringLoader);
-$latte->addExtension(new FormsExtension);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabel()) %A%',
- $latte->compile('{label foo /}'),
-);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabel())?->addAttributes([\'class\' => \'foo\']) %A%',
- $latte->compile('{label foo class => foo /}'),
-);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabel())?->addAttributes([\'class\' => \'foo\']) %A%',
- $latte->compile('{label foo, class => foo /}'),
-);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabelPart(\'\')) %A%',
- $latte->compile('{label foo: /}'),
-);
-
-Assert::exception(
- fn() => $latte->compile('{label foo: class => foo /}'),
- Latte\CompileException::class,
- "Unexpected '=>', expecting end of tag in {label} (on line 1 at column 19)",
-);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabelPart(\'\')) %A%',
- $latte->compile('{label foo:, /}'),
-);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabelPart(\'\'))?->addAttributes([\'class\' => \'foo\']) %A%',
- $latte->compile('{label foo:, class => foo /}'),
-);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabelPart(\'x\')) %A%',
- $latte->compile('{label foo:x /}'),
-);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabelPart(\'x\'))?->addAttributes([\'class\' => \'foo\']) %A%',
- $latte->compile('{label foo:x, class => foo /}'),
-);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabelPart(\'x\')) %A%',
- $latte->compile('{label "foo":"x" /}'),
-);
-
-Assert::match(
- '%A%echo ($ʟ_label = Nette\Bridges\FormsLatte\Runtime::item(\'foo\', $this->global)->getLabelPart(\'x\')) %A%',
- $latte->compile('{label "foo" : "x" /}'),
-);
diff --git a/tests/Forms/Container.getControls().phpt b/tests/Forms/Container.getControls().phpt
index 5c4d2bef0..3c605a6ef 100644
--- a/tests/Forms/Container.getControls().phpt
+++ b/tests/Forms/Container.getControls().phpt
@@ -15,22 +15,4 @@ $form->addContainer('cont')
->addText('name');
$controls = $form->getControls();
-
-$names = $values = [];
-foreach ($controls as $name => $value) {
- $names[] = $name;
- $values[] = $value;
-}
-
-Assert::same(['name', 'age', 'name'], $names);
-Assert::same([$form['name'], $form['age'], $form['cont-name']], $values);
-
-// again
-$names = $values = [];
-foreach ($controls as $name => $value) {
- $names[] = $name;
- $values[] = $value;
-}
-
-Assert::same(['name', 'age', 'name'], $names);
-Assert::same([$form['name'], $form['age'], $form['cont-name']], $values);
+Assert::same([$form['name'], $form['age'], $form['cont-name']], $controls);
diff --git a/tests/Forms/Container.values.mapping.phpt b/tests/Forms/Container.values.mapping.phpt
index 043d6cbc7..4e27d1797 100644
--- a/tests/Forms/Container.values.mapping.phpt
+++ b/tests/Forms/Container.values.mapping.phpt
@@ -11,15 +11,14 @@ use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
-#[AllowDynamicProperties]
-class FormData
+class FormData extends stdClass
{
public string $title;
public FormFirstLevel $first;
}
-class FormFirstLevel
+class FormFirstLevel extends stdClass
{
public string $name;
public ?int $age = null;
@@ -27,7 +26,7 @@ class FormFirstLevel
}
-class FormSecondLevel
+class FormSecondLevel extends stdClass
{
public string $city;
}
diff --git a/tests/Forms/Forms.renderer.2.phpt b/tests/Forms/Forms.renderer.2.phpt
index 813271bd8..f9fa1f1ca 100644
--- a/tests/Forms/Forms.renderer.2.phpt
+++ b/tests/Forms/Forms.renderer.2.phpt
@@ -38,7 +38,7 @@ $sex = [
$form = new Form;
-$renderer = $form->renderer;
+$renderer = $form->getRenderer();
$renderer->wrappers['form']['container'] = Html::el('div')->id('form');
$renderer->wrappers['form']['errors'] = false;
$renderer->wrappers['group']['container'] = null;
diff --git a/tests/netteForms/karma.conf.ts b/tests/netteForms/karma.conf.ts
index 3712c64dd..059cb3d01 100644
--- a/tests/netteForms/karma.conf.ts
+++ b/tests/netteForms/karma.conf.ts
@@ -4,7 +4,7 @@ module.exports = function (config) {
frameworks: ['jasmine'],
browsers: ['ChromeHeadless'],
files: [
- '../../src/assets/netteForms.js',
+ '../../src/assets/dist/nette-forms.umd.js',
'spec/*Spec.js',
],
autoWatch: false,