2022-07-16 23:28:13 +05:30
|
|
|
import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
|
2018-11-20 20:47:30 +05:30
|
|
|
import initReadMore from '~/read_more';
|
|
|
|
|
|
|
|
describe('Read more click-to-expand functionality', () => {
|
2019-07-07 11:18:12 +05:30
|
|
|
const fixtureName = 'projects/overview.html';
|
2018-11-20 20:47:30 +05:30
|
|
|
|
|
|
|
beforeEach(() => {
|
2022-07-16 23:28:13 +05:30
|
|
|
loadHTMLFixture(fixtureName);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
resetHTMLFixture();
|
2018-11-20 20:47:30 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|