docbrown/app/javascript/admin/__tests__/controllers/config_controller.test.js
rhymes e5226b9951
Upgrade Stimulus to 3.0 (#14869)
* Upgrade Stimulus to 3.0

* Remove unused variable

* Bump postcss from 8.3.8 to 8.3.9 (#14956)

Bumps [postcss](https://github.com/postcss/postcss) from 8.3.8 to 8.3.9.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.3.8...8.3.9)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-05 20:00:37 +02:00

34 lines
980 B
JavaScript

import { Application } from '@hotwired/stimulus';
import ConfigController from '../../controllers/config_controller';
describe('ConfigController', () => {
beforeEach(() => {
document.body.innerHTML = `
<div data-controller="config">
<button data-action="click->config#activateEmailAuthModal">
Disable
</button>
<div data-config-target="configModalAnchor"></div>
</div>`;
global.scrollTo = jest.fn();
const application = Application.start();
application.register('config', ConfigController);
});
describe('#activateEmailAuthModal', () => {
it('builds and adds a Modal to the page', () => {
const button = document.getElementsByTagName('button')[0];
const modalAnchor = document.querySelector(
'[data-config-target="configModalAnchor"]',
);
button.click();
expect(
modalAnchor.firstElementChild.classList.contains('crayons-modal'),
).toBe(true);
});
});
});