Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ae5d325
UX FormCollection
stakovicz May 3, 2021
c305f0c
Remove hard coded property_name __name__
stakovicz May 4, 2021
5e6dd84
PHP CS Fixer
stakovicz May 4, 2021
eea2313
First jests
stakovicz May 4, 2021
f651d90
Rename CollectionType > UXCollectionType
stakovicz May 6, 2021
cc02076
Rename CollectionType > UXCollectionType
stakovicz May 6, 2021
dceb2cf
DependencyInjection Clean
stakovicz May 6, 2021
dfb54f8
Fix .gitattributes
stakovicz May 6, 2021
9300cda
Move default values
stakovicz May 7, 2021
ec4342a
Predefined theme or not
stakovicz May 23, 2021
b4f40cd
Update src/FormCollection/README.md
stakovicz May 24, 2021
0584757
Update src/FormCollection/README.md
stakovicz May 24, 2021
abd2b8f
Update src/FormCollection/README.md
stakovicz May 24, 2021
3996f3b
Update src/FormCollection/Resources/views/form_theme_div.html.twig
stakovicz May 24, 2021
aaa6811
Update src/FormCollection/README.md
stakovicz May 24, 2021
4791ff9
Update src/FormCollection/Resources/views/form_theme_table.html.twig
stakovicz May 24, 2021
8539ff9
Split in 4 options
stakovicz May 24, 2021
2d1ed04
Default startIndex value
stakovicz Jun 6, 2021
1e3105d
Update src/FormCollection/Resources/views/form_theme_div.html.twig
stakovicz Jul 21, 2021
0a9cc54
Update src/FormCollection/Resources/views/form_theme_div.html.twig
stakovicz Jul 21, 2021
94be94c
Update src/FormCollection/Resources/views/form_theme_table.html.twig
stakovicz Jul 21, 2021
c805c0e
Update src/FormCollection/Resources/views/form_theme_table.html.twig
stakovicz Jul 21, 2021
e56d04b
Fix coding-style-js
stakovicz Nov 6, 2021
7467cee
Prettier
stakovicz Nov 6, 2021
a8c730c
Merge branch 'symfony:2.x' into main
stakovicz Jan 19, 2022
ecd774a
Merge branch 'symfony:2.x' into main
stakovicz May 7, 2022
25d8306
Rebase and refresh the code
stakovicz May 21, 2022
8e5cd8a
fix TU
stakovicz May 21, 2022
3b110f9
change buttons attr
stakovicz May 21, 2022
c36157c
Merge branch 'symfony:2.x' into main
stakovicz Jun 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
First jests
  • Loading branch information
stakovicz committed Nov 6, 2021
commit eea23134f7a9fa39622254a9060a1687d63ca7b0
6 changes: 6 additions & 0 deletions src/FormCollection/Resources/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,11 @@
"@babel/preset-env": "^7.12.7",
"@symfony/stimulus-testing": "^1.1.0",
"stimulus": "^2.0.0"
},
"jest": {
"testRegex": "test/.*\\.test.js",
"setupFilesAfterEnv": [
"./test/setup.js"
]
}
}
60 changes: 60 additions & 0 deletions src/FormCollection/Resources/assets/test/controller.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

'use strict';

import { Application, Controller } from 'stimulus';
import { getByTestId, waitFor } from '@testing-library/dom';
import user from '@testing-library/user-event';
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
import FormCollectionController from '../dist/controller';

// Controller used to check the actual controller was properly booted
class CheckController extends Controller {
connect() {
this.element.addEventListener('form-collection:pre-connect', () => {
this.element.classList.add('pre-connected');
});
this.element.addEventListener('form-collection:connect', () => {
this.element.classList.add('connected');
});
}
}

const startStimulus = () => {
const application = Application.start();
application.register('check', CheckController);
application.register('formCollection', FormCollectionController);
};

describe('FormCollectionController', () => {
let container;

beforeEach(() => {
container = mountDOM(`
<div class="container" data-controller="check formCollection" data-testid="container">

</div>
`);
});

afterEach(() => {
clearDOM();
});

it('events', async () => {
expect(getByTestId(container, 'container')).not.toHaveClass('connected');
expect(getByTestId(container, 'container')).not.toHaveClass('pre-connected');

startStimulus();
await waitFor(() => expect(getByTestId(container, 'container')).toHaveClass('connected'));
await waitFor(() => expect(getByTestId(container, 'container')).toHaveClass('pre-connected'));
});

});
12 changes: 12 additions & 0 deletions src/FormCollection/Resources/assets/test/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

'use strict';

import '@symfony/stimulus-testing/setup';