Skip to content

Commit 2c12300

Browse files
committed
Merge branch '2.x' into 3.x
# By Hugo Alliaume (8) and Marcus Stöhr (1) * 2.x: Add E2E tests for CropperJS Add E2E tests for Turbo Add E2E tests for Chart.js Add E2E tests for LiveComponent feat(toolkit): add input-group component for shadcn kit Add E2E tests for Autocomplete [Site] Hide Toolkit from packages list [Site] Fix examples from Translator page [Site] Update UX packages # Conflicts: # ux.symfony.com/composer.lock
2 parents fa2c37c + 356ee98 commit 2c12300

File tree

124 files changed

+3298
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+3298
-252
lines changed

.github/workflows/browser-tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ jobs:
7373

7474
- name: Configure E2E app
7575
run: |
76-
echo 'APP_ENV=prod' >> .env.local
77-
echo 'APP_DEBUG=0' >> .env.local
7876
echo 'APP_SECRET=df4c071596e64cc75a349456f2887ae2419ae650' >> .env.local
7977
working-directory: apps/e2e
8078

@@ -83,11 +81,12 @@ jobs:
8381
with:
8482
working-directory: apps/e2e
8583
dependency-versions: highest
86-
composer-options: --no-dev
8784
custom-cache-suffix: symfony-${{ matrix.symfony }}
8885

8986
- name: Prepare E2E app
9087
run: |
88+
echo 'APP_ENV=prod' >> .env.local
89+
echo 'APP_DEBUG=0' >> .env.local
9190
symfony composer dump-autoload --classmap-authoritative --no-dev
9291
symfony composer dump-env
9392
symfony console asset-map:compile

apps/e2e/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ APP_SECRET=
2323
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
2424
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
2525
#
26-
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
26+
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
2727
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
2828
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
2929
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"

apps/e2e/.symfony.local.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
http:
22
port: 9876
3+
no_tls: true
Lines changed: 1 addition & 0 deletions
Loading

apps/e2e/composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"auto-scripts": {
88
"cache:clear": "symfony-cmd",
99
"assets:install %PUBLIC_DIR%": "symfony-cmd",
10-
"importmap:install": "symfony-cmd"
10+
"importmap:install": "symfony-cmd",
11+
"foundry:load-fixtures": "symfony-cmd"
1112
},
1213
"post-install-cmd": [
1314
"@auto-scripts"
@@ -37,7 +38,10 @@
3738
"symfony/http-client": "6.4.*|7.3.*",
3839
"symfony/intl": "6.4.*|7.3.*",
3940
"symfony/monolog-bundle": "^3.10",
41+
"symfony/property-access": "6.4.*|7.3.*",
42+
"symfony/property-info": "6.4.*|7.3.*",
4043
"symfony/runtime": "6.4.*|7.3.*",
44+
"symfony/serializer": "6.4.*|7.3.*",
4145
"symfony/stimulus-bundle": "^2.29.1",
4246
"symfony/twig-bundle": "6.4.*|7.3.*",
4347
"symfony/ux-autocomplete": "^2.29.1",
@@ -69,7 +73,8 @@
6973
"symfony/debug-bundle": "6.4.*|7.3.*",
7074
"symfony/maker-bundle": "^1.64",
7175
"symfony/stopwatch": "6.4.*|7.3.*",
72-
"symfony/web-profiler-bundle": "6.4.*|7.3.*"
76+
"symfony/web-profiler-bundle": "6.4.*|7.3.*",
77+
"zenstruck/foundry": "^2.8"
7378
},
7479
"config": {
7580
"platform": {

apps/e2e/config/bundles.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@
3030
Symfony\UX\Translator\UxTranslatorBundle::class => ['all' => true],
3131
Symfony\UX\Typed\TypedBundle::class => ['all' => true],
3232
Symfony\UX\Vue\VueBundle::class => ['all' => true],
33+
Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev' => true, 'test' => true],
3334
];
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
when@dev: &dev
2+
# See full configuration: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#full-default-bundle-configuration
3+
zenstruck_foundry:
4+
persistence:
5+
# Flush only once per call of `PersistentObjectFactory::create()`
6+
flush_once: true
7+
8+
# If you use the `make:factory --test` command, you may need to uncomment the following.
9+
# See https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#generate
10+
#services:
11+
# App\Tests\Factory\:
12+
# resource: '%kernel.project_dir%/tests/Factory/'
13+
# autowire: true
14+
# autoconfigure: true
15+
16+
when@test: *dev

apps/e2e/public/images/example.jpg

19.6 KB
Loading

apps/e2e/src/Controller/AutocompleteController.php

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,66 @@
22

33
namespace App\Controller;
44

5-
use App\Form\Type\AutocompleteSelectType;
5+
use App\Form\FruitAutocompleteField;
66
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
7+
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
8+
use Symfony\Component\HttpFoundation\Response;
79
use Symfony\Component\Routing\Attribute\Route;
810

9-
#[Route('/ux-autocomplete')]
11+
#[Route('/ux-autocomplete', name: 'app_ux_autocomplete_')]
1012
final class AutocompleteController extends AbstractController
1113
{
12-
#[Route('/without-ajax')]
13-
public function index()
14+
#[Route('/without-ajax', name: 'without_ajax')]
15+
public function withoutAjax(): Response
1416
{
15-
$form = $this->createForm(AutocompleteSelectType::class);
17+
$formBuilder = $this->createFormBuilder();
18+
$formBuilder->add('favorite_fruit', ChoiceType::class, [
19+
'autocomplete' => true,
20+
'label' => 'Your favorite fruit:',
21+
'choices' => [
22+
'Apple' => 'apple',
23+
'Banana' => 'banana',
24+
'Cherry' => 'cherry',
25+
'Coconut' => 'coconut',
26+
'Grape' => 'grape',
27+
'Kiwi' => 'kiwi',
28+
'Lemon' => 'lemon',
29+
'Mango' => 'mango',
30+
'Orange' => 'orange',
31+
'Papaya' => 'papaya',
32+
'Peach' => 'peach',
33+
'Pineapple' => 'pineapple',
34+
'Pear' => 'pear',
35+
'Pomegranate' => 'pomegranate',
36+
'Pomelo' => 'pomelo',
37+
'Raspberry' => 'raspberry',
38+
'Strawberry' => 'strawberry',
39+
'Watermelon' => 'watermelon',
40+
],
41+
]);
1642

17-
return $this->render(
18-
'ux_autocomplete/index.html.twig',
19-
['form' => $form->createView()]
20-
);
43+
$form = $formBuilder->getForm();
44+
45+
return $this->render('ux_autocomplete/without_ajax.html.twig', [
46+
'form' => $form->createView()
47+
]);
48+
}
49+
50+
#[Route('/with-ajax', name: 'with_ajax')]
51+
public function withAjax(): Response
52+
{
53+
$formBuilder = $this->createFormBuilder();
54+
$formBuilder->add('favorite_fruit', FruitAutocompleteField::class);
55+
56+
$form = $formBuilder->getForm();
57+
58+
return $this->render('ux_autocomplete/with_ajax.html.twig', [
59+
'form' => $form->createView()
60+
]);
2161
}
2262

23-
#[Route('/custom-controller')]
24-
public function customController()
63+
#[Route('/custom-controller', name: 'custom_controller')]
64+
public function customController(): Response
2565
{
2666
return $this->render('ux_autocomplete/custom_controller.html.twig');
2767
}

apps/e2e/src/Controller/ChartjsController.php

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
use Symfony\UX\Chartjs\Builder\ChartBuilderInterface;
99
use Symfony\UX\Chartjs\Model\Chart;
1010

11-
#[Route('/ux-chartjs')]
11+
#[Route('/ux-chartjs', name: 'app_ux_chartjs_')]
1212
final class ChartjsController extends AbstractController
1313
{
14-
#[Route('/without-options')]
14+
#[Route('/without-options', name: 'without_options')]
1515
public function withoutOptions(ChartBuilderInterface $chartBuilder): Response
1616
{
1717
$chart = $chartBuilder->createChart(Chart::TYPE_LINE);
@@ -33,7 +33,7 @@ public function withoutOptions(ChartBuilderInterface $chartBuilder): Response
3333
]);
3434
}
3535

36-
#[Route('/with-options')]
36+
#[Route('/with-options', name: 'with_options')]
3737
public function withOptions(ChartBuilderInterface $chartBuilder): Response
3838
{
3939
$chart = $chartBuilder->createChart(Chart::TYPE_LINE);
@@ -58,4 +58,69 @@ public function withOptions(ChartBuilderInterface $chartBuilder): Response
5858
'chart' => $chart,
5959
]);
6060
}
61+
62+
#[Route('/pie', name: 'pie')]
63+
public function pie(ChartBuilderInterface $chartBuilder): Response
64+
{
65+
$chart = $chartBuilder->createChart(Chart::TYPE_PIE);
66+
67+
$chart->setData([
68+
'labels' => ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
69+
'datasets' => [
70+
[
71+
'label' => 'My First Dataset',
72+
'data' => [12, 19, 3, 5, 2, 3],
73+
'backgroundColor' => [
74+
'rgb(255, 99, 132)',
75+
'rgb(54, 162, 235)',
76+
'rgb(255, 205, 86)',
77+
'rgb(75, 192, 192)',
78+
'rgb(153, 102, 255)',
79+
'rgb(255, 159, 64)',
80+
],
81+
],
82+
],
83+
]);
84+
85+
return $this->render('ux_chartjs/index.html.twig', [
86+
'chart' => $chart,
87+
]);
88+
}
89+
90+
#[Route('/pie-with-options', name: 'pie_with_options')]
91+
public function pieWithOptions(ChartBuilderInterface $chartBuilder): Response
92+
{
93+
$chart = $chartBuilder->createChart(Chart::TYPE_PIE);
94+
95+
$chart->setData([
96+
'labels' => ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
97+
'datasets' => [
98+
[
99+
'label' => 'My First Dataset',
100+
'data' => [12, 19, 3, 5, 2, 3],
101+
'backgroundColor' => [
102+
'rgb(255, 99, 132)',
103+
'rgb(54, 162, 235)',
104+
'rgb(255, 205, 86)',
105+
'rgb(75, 192, 192)',
106+
'rgb(153, 102, 255)',
107+
'rgb(255, 159, 64)',
108+
],
109+
],
110+
],
111+
]);
112+
113+
$chart->setOptions([
114+
'responsive' => true,
115+
'plugins' => [
116+
'legend' => [
117+
'position' => 'top',
118+
],
119+
],
120+
]);
121+
122+
return $this->render('ux_chartjs/index.html.twig', [
123+
'chart' => $chart,
124+
]);
125+
}
61126
}

0 commit comments

Comments
 (0)