diff --git a/entry_types/scrolled/package/spec/frontend/features/sectionFirstClass-spec.js b/entry_types/scrolled/package/spec/frontend/features/sectionFirstClass-spec.js new file mode 100644 index 0000000000..cec22b4809 --- /dev/null +++ b/entry_types/scrolled/package/spec/frontend/features/sectionFirstClass-spec.js @@ -0,0 +1,67 @@ +import React from 'react'; +import {act} from '@testing-library/react'; +import '@testing-library/jest-dom/extend-expect'; + +import {frontend} from 'frontend'; +import {renderEntry, usePageObjects} from 'support/pageObjects'; +import {changeLocationHash} from 'support/changeLocationHash'; + +import styles from 'frontend/Section.module.css'; + +describe('section first class', () => { + usePageObjects(); + + beforeEach(() => window.location.hash = '#initial'); + + it('is applied to first section of main storyline', () => { + const {getSectionByPermaId} = renderEntry({ + seed: { + sections: [{id: 1, permaId: 10}, {id: 2, permaId: 11}] + } + }); + + expect(getSectionByPermaId(10).el).toHaveClass(styles.first); + }); + + it('is not applied to second section of main storyline', () => { + const {getSectionByPermaId} = renderEntry({ + seed: { + sections: [{id: 1, permaId: 10}, {id: 2, permaId: 11}] + } + }); + + expect(getSectionByPermaId(11).el).not.toHaveClass(styles.first); + }); + + it('is not applied to first section of excursion', () => { + frontend.widgetTypes.register('excursionOverlay', { + component: function ({children}) { + return