debian-mirror-gitlab/spec/frontend/read_more_spec.js
2022-07-17 14:43:12 +02:00

26 lines
714 B
JavaScript

import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import initReadMore from '~/read_more';
describe('Read more click-to-expand functionality', () => {
const fixtureName = 'projects/overview.html';
beforeEach(() => {
loadHTMLFixture(fixtureName);
});
afterEach(() => {
resetHTMLFixture();
});
describe('expands target element', () => {
it('adds "is-expanded" class to target element', () => {
const target = document.querySelector('.read-more-container');
const trigger = document.querySelector('.js-read-more-trigger');
initReadMore();
trigger.click();
expect(target.classList.contains('is-expanded')).toEqual(true);
});
});
});