debian-mirror-gitlab/spec/frontend/behaviors/autosize_spec.js

25 lines
571 B
JavaScript
Raw Normal View History

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