2017-05-16 21:01:51 +00:00
|
|
|
import '~/behaviors/autosize';
|
2016-07-24 20:45:11 +00:00
|
|
|
|
2017-11-27 23:13:11 +00:00
|
|
|
function load() {
|
2020-09-17 21:09:39 +00:00
|
|
|
document.dispatchEvent(new Event('DOMContentLoaded'));
|
2017-11-27 23:13:11 +00:00
|
|
|
}
|
|
|
|
|
2020-09-17 21:09:39 +00:00
|
|
|
jest.mock('~/helpers/startup_css_helper', () => {
|
|
|
|
return {
|
|
|
|
waitForCSSLoaded: jest.fn().mockImplementation(cb => cb.apply()),
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2017-11-27 23:13:11 +00:00
|
|
|
describe('Autosize behavior', () => {
|
|
|
|
beforeEach(() => {
|
2020-09-17 21:09:39 +00:00
|
|
|
setFixtures('<textarea class="js-autosize"></textarea>');
|
2017-11-27 23:13:11 +00:00
|
|
|
});
|
|
|
|
|
2020-09-17 21:09:39 +00:00
|
|
|
it('is applied to the textarea', () => {
|
2017-11-27 23:13:11 +00:00
|
|
|
load();
|
2018-10-09 18:03:09 +00:00
|
|
|
|
2020-09-17 21:09:39 +00:00
|
|
|
const textarea = document.querySelector('textarea');
|
|
|
|
expect(textarea.classList).toContain('js-autosize-initialized');
|
2016-07-24 20:45:11 +00:00
|
|
|
});
|
2017-11-27 23:13:11 +00:00
|
|
|
});
|