summaryrefslogtreecommitdiff
path: root/spec/javascripts/read_more_spec.js
blob: b1af0f80a50c11211f2ad6a5ad7cde8e9e10e70c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import initReadMore from '~/read_more';

describe('Read more click-to-expand functionality', () => {
  const fixtureName = 'projects/overview.html.raw';

  preloadFixtures(fixtureName);

  beforeEach(() => {
    loadFixtures(fixtureName);
  });

  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);
    });
  });
});