Skip to content

Commit b7582c6

Browse files
committed
minor #2879 Remove `@symfony/stimulus-testing` dev dependencies (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- Remove ``@symfony`/stimulus-testing` dev dependencies | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Docs? | no <!-- required for new features --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - For new features, provide some code snippets to help understand usage. - Features and deprecations must be submitted against branch main. - Update/add documentation as required (we can help!) - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> I plan to deprecate ``@symfony`/stimulus-testing`, the library is too much opinionated by depending on Jest and Babel. From 837 to 442 (dev)dependencies 🎉 Commits ------- bbe6bd1 Remove `@symfony`/stimulus-testing
2 parents fb7e6c6 + bbe6bd1 commit b7582c6

File tree

21 files changed

+345
-3698
lines changed

21 files changed

+345
-3698
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
"@rollup/plugin-commonjs": "^28.0.6",
1818
"@rollup/plugin-node-resolve": "^16.0.1",
1919
"@rollup/plugin-typescript": "^12.1.4",
20-
"@symfony/stimulus-testing": "^2.0.1",
20+
"@testing-library/dom": "^10.4.0",
21+
"@testing-library/jest-dom": "^6.6.3",
22+
"@testing-library/user-event": "^14.6.1",
2123
"@types/node": "^22.6.0",
2224
"@vitest/browser": "^2.1.1",
25+
"jsdom": "^26.1.0",
2326
"lightningcss": "^1.28.2",
2427
"playwright": "^1.47.0",
2528
"rollup": "^4.44.1",

src/Cropperjs/assets/test/controller.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*/
99

1010
import { Application, Controller } from '@hotwired/stimulus';
11-
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
1211
import { getByTestId, waitFor } from '@testing-library/dom';
12+
import { clearDOM, mountDOM } from '../../../../test/stimulus-helpers';
1313
import CropperjsController from '../src/controller';
1414

1515
let cropper: Cropper | null = null;
@@ -44,7 +44,7 @@ describe('CropperjsController', () => {
4444
beforeEach(() => {
4545
container = mountDOM(`
4646
<div id="form_photo" class="cropperjs">
47-
<input type="hidden" id="form_photo_options" name="form[photo][options]"
47+
<input type="hidden" id="form_photo_options" name="form[photo][options]"
4848
data-testid="input"
4949
data-controller="check cropperjs"
5050
data-cropperjs-public-url-value="https://symfony.com/logos/symfony_black_02.png"

src/Dropzone/assets/test/controller.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
*/
99

1010
import { Application, Controller } from '@hotwired/stimulus';
11-
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
1211
import { getByTestId, waitFor } from '@testing-library/dom';
1312
import user from '@testing-library/user-event';
13+
import { clearDOM, mountDOM } from '../../../../test/stimulus-helpers';
1414
import DropzoneController from '../src/controller';
1515

1616
// Controller used to check the actual controller was properly booted
@@ -33,35 +33,35 @@ describe('DropzoneController', () => {
3333

3434
beforeEach(() => {
3535
container = mountDOM(`
36-
<div class="dropzone-container" data-controller="check dropzone" data-testid="container">
36+
<div class="dropzone-container" data-controller="check dropzone" data-testid="container">
3737
<input type="file"
3838
style="display: none"
3939
data-dropzone-target="input"
4040
data-testid="input" />
41-
42-
<div class="dropzone-placeholder"
43-
data-dropzone-target="placeholder"
41+
42+
<div class="dropzone-placeholder"
43+
data-dropzone-target="placeholder"
4444
data-testid="placeholder">
4545
Placeholder
4646
</div>
47-
47+
4848
<div class="dropzone-preview"
4949
data-dropzone-target="preview"
5050
data-testid="preview"
5151
style="display: none">
52-
52+
5353
<button type="button"
5454
class="dropzone-preview-button"
5555
data-dropzone-target="previewClearButton"
5656
data-testid="button"></button>
57-
57+
5858
<div class="dropzone-preview-image"
5959
data-dropzone-target="previewImage"
6060
data-testid="preview-image"
6161
style="display: none"></div>
62-
62+
6363
<div class="dropzone-preview-filename"
64-
data-dropzone-target="previewFilename"
64+
data-dropzone-target="previewFilename"
6565
data-testid="preview-filename"></div>
6666
</div>
6767
</div>
@@ -119,7 +119,7 @@ describe('DropzoneController', () => {
119119
const input = getByTestId(container, 'input');
120120
const file = new File(['hello'], 'hello.png', { type: 'image/png' });
121121

122-
user.upload(input, file);
122+
await user.upload(input, file);
123123
expect(input.files[0]).toStrictEqual(file);
124124

125125
// The dropzone should be in preview mode

src/LazyImage/assets/test/controller.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*/
99

1010
import { Application, Controller } from '@hotwired/stimulus';
11-
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
1211
import { getByTestId, waitFor } from '@testing-library/dom';
12+
import { clearDOM, mountDOM } from '../../../../test/stimulus-helpers';
1313
import LazyImageController from '../src/controller';
1414

1515
// Controller used to check the actual controller was properly booted
@@ -35,7 +35,7 @@ describe('LazyImageController', () => {
3535

3636
beforeEach(() => {
3737
container = mountDOM(`
38-
<img
38+
<img
3939
src="https://symfony.com/logos/symfony_black_02.png"
4040
srcset="https://symfony.com/logos/symfony_black_02.png 1x, https://symfony.com/logos/symfony_black_02.png 2x"
4141
data-testid="img"

src/LiveComponent/assets/test/Rendering/ExternalMutationTracker.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('ExternalMutationTracker', () => {
100100
expect(changes.getChangedStyles()).toEqual([
101101
{ name: 'display', value: 'inline' },
102102
{ name: 'color', value: 'red' },
103-
{ name: 'background-image', value: 'url(https://example.com/image.png)' },
103+
{ name: 'background-image', value: 'url("https://example.com/image.png")' },
104104
]);
105105
expect(changes.getRemovedStyles()).toEqual(['margin']);
106106
});
@@ -137,7 +137,7 @@ describe('ExternalMutationTracker', () => {
137137

138138
it('can track class changes with whitespaces', async () => {
139139
const { element, tracker } = createTracker(`
140-
<div
140+
<div
141141
class="
142142
first-class
143143
second-class

src/Map/assets/test/abstract_map_controller.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Application } from '@hotwired/stimulus';
2-
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
32
import { getByTestId, waitFor } from '@testing-library/dom';
4-
import * as L from 'leaflet';
3+
import { clearDOM, mountDOM } from '../../../../test/stimulus-helpers';
54
import AbstractMapController from '../src/abstract_map_controller.ts';
65

76
class MyMapController extends AbstractMapController {

src/Map/src/Bridge/Google/assets/test/map_controller.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*/
99

1010
import { Application, Controller } from '@hotwired/stimulus';
11-
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
1211
import { getByTestId, waitFor } from '@testing-library/dom';
12+
import { clearDOM, mountDOM } from '../../../../../../../test/stimulus-helpers';
1313
import GoogleController from '../src/map_controller';
1414

1515
// Controller used to check the actual controller was properly booted

src/Map/src/Bridge/Leaflet/assets/test/map_controller.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*/
99

1010
import { Application, Controller } from '@hotwired/stimulus';
11-
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
1211
import { getByTestId, waitFor } from '@testing-library/dom';
12+
import { clearDOM, mountDOM } from '../../../../../../../test/stimulus-helpers';
1313
import LeafletController from '../src/map_controller';
1414

1515
// Controller used to check the actual controller was properly booted

src/Notify/assets/test/controller.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
*/
99

1010
import { Application, Controller } from '@hotwired/stimulus';
11-
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
1211
import { getByTestId, waitFor } from '@testing-library/dom';
1312
import { vi } from 'vitest';
13+
import { clearDOM, mountDOM } from '../../../../test/stimulus-helpers';
1414
import NotifyController from '../src/controller';
1515

1616
// Controller used to check the actual controller was properly booted

src/React/assets/test/render_controller.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
*/
99

1010
import { Application, Controller } from '@hotwired/stimulus';
11-
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
1211
import { getByTestId, waitFor } from '@testing-library/dom';
1312
import React from 'react';
13+
import { clearDOM, mountDOM } from '../../../../test/stimulus-helpers';
1414
import ReactController from '../src/render_controller';
1515

1616
// Controller used to check the actual controller was properly booted

0 commit comments

Comments
 (0)