-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FormNNameNode: $form is created before tag itself [Closes #291]
- Loading branch information
Showing
5 changed files
with
91 additions
and
22 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
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
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,55 @@ | ||
<?php | ||
|
||
/** @phpVersion 8.0 */ | ||
|
||
declare(strict_types=1); | ||
|
||
use Nette\Bridges\FormsLatte\FormsExtension; | ||
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( | ||
<<<'XX' | ||
%A% | ||
$form = $this->global->formsStack[] = $this->global->uiControl['foo'] /* line 1 */; | ||
echo '<form'; | ||
echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin(end($this->global->formsStack), [], false) /* line 1 */; | ||
echo '>'; | ||
echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(end($this->global->formsStack), false) /* line 1 */; | ||
echo '</form>'; | ||
array_pop($this->global->formsStack); | ||
%A% | ||
XX, | ||
$latte->compile('<form n:name="foo"></form>'), | ||
); | ||
|
||
|
||
Assert::match( | ||
<<<'XX' | ||
%A% | ||
$form = $this->global->formsStack[] = $this->global->uiControl['foo'] /* line 1 */; | ||
$ʟ_tag[0] = ''; | ||
if (0) /* line 1 */ { | ||
echo '<'; | ||
echo $ʟ_tmp = ('form'); | ||
$ʟ_tag[0] = '</' . $ʟ_tmp . '>' . $ʟ_tag[0]; | ||
echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin(end($this->global->formsStack), [], false) /* line 1 */; | ||
echo '>'; | ||
} | ||
echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(end($this->global->formsStack), false) /* line 1 */; | ||
echo $ʟ_tag[0]; | ||
array_pop($this->global->formsStack); | ||
%A% | ||
XX, | ||
$latte->compile('<form n:tag-if=0 n:name="foo"></form>'), | ||
); |