Skip to content

Commit

Permalink
[make:twig-component] default to "no" when asking if is live component
Browse files Browse the repository at this point in the history
fixes #1395
  • Loading branch information
jrushlow committed Feb 28, 2024
1 parent cdcd168 commit 32cbea5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Maker/MakeTwigComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void
{
if (!$input->getOption('live')) {
$input->setOption('live', $io->confirm('Make this a live component?', class_exists(AsLiveComponent::class)));
$input->setOption('live', $io->confirm('Make this a live component?', false));
}
}
}
4 changes: 2 additions & 2 deletions tests/Maker/MakeTwigComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function getTestDetails(): \Generator
yield 'it_generates_live_component' => [$this->createMakerTest()
->addExtraDependencies('symfony/ux-live-component', 'symfony/twig-bundle')
->run(function (MakerTestRunner $runner) {
$output = $runner->runMaker(['Alert']);
$output = $runner->runMaker(['Alert', 'y']);

$this->assertStringContainsString('src/Twig/Components/Alert.php', $output);
$this->assertStringContainsString('templates/components/Alert.html.twig', $output);
Expand All @@ -76,7 +76,7 @@ public function getTestDetails(): \Generator
yield 'it_generates_pascal_case_live_component' => [$this->createMakerTest()
->addExtraDependencies('symfony/ux-live-component', 'symfony/twig-bundle')
->run(function (MakerTestRunner $runner) {
$output = $runner->runMaker(['FormInput']);
$output = $runner->runMaker(['FormInput', 'y']);

$this->assertStringContainsString('src/Twig/Components/FormInput.php', $output);
$this->assertStringContainsString('templates/components/FormInput.html.twig', $output);
Expand Down

0 comments on commit 32cbea5

Please sign in to comment.