2022-05-13 08:08:49 -04:00
|
|
|
import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
|
2018-09-06 03:27:39 -04:00
|
|
|
import initReadMore from '~/read_more';
|
|
|
|
|
|
|
|
describe('Read more click-to-expand functionality', () => {
|
2019-03-26 12:03:28 -04:00
|
|
|
const fixtureName = 'projects/overview.html';
|
2018-09-06 03:27:39 -04:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2022-05-13 08:08:49 -04:00
|
|
|
loadHTMLFixture(fixtureName);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
resetHTMLFixture();
|
2018-09-06 03:27:39 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|