gitlab-org--gitlab-foss/spec/frontend/behaviors/autosize_spec.js

25 lines
571 B
JavaScript
Raw Normal View History

import '~/behaviors/autosize';
2016-07-24 20:45:11 +00:00
2017-11-27 23:13:11 +00:00
function load() {
document.dispatchEvent(new Event('DOMContentLoaded'));
2017-11-27 23:13:11 +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(() => {
setFixtures('<textarea class="js-autosize"></textarea>');
2017-11-27 23:13:11 +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
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
});