add shortcut to jump between blocks (#1181)

* add shortcut

* chore: rename getRelevantBlock to getPreviousBlock
This commit is contained in:
Alex Christoffer Rasmussen
2024-08-19 17:20:58 +02:00
committed by GitHub
parent f708dc0bc4
commit 340f5478fb
7 changed files with 130 additions and 25 deletions
@@ -8,8 +8,8 @@ import {
getNext,
getNextEvent,
getPrevious,
getPreviousBlock,
getPreviousEvent,
getRelevantBlock,
swapEventData,
} from './rundownUtils';
@@ -278,23 +278,23 @@ describe('getLastEvent', () => {
];
it('returns the relevant block', () => {
const block = getRelevantBlock(testRundown as unknown as OntimeRundown, 'h');
const block = getPreviousBlock(testRundown as unknown as OntimeRundown, 'h');
expect(block?.id).toBe('g');
});
it('returns the relevant block', () => {
const block = getRelevantBlock(testRundown as unknown as OntimeRundown, 'f');
const block = getPreviousBlock(testRundown as unknown as OntimeRundown, 'f');
expect(block?.id).toBe('e');
});
it('returns the relevant block', () => {
const block = getRelevantBlock(testRundown as unknown as OntimeRundown, 'a');
const block = getPreviousBlock(testRundown as unknown as OntimeRundown, 'a');
expect(block).toBeNull();
});
it('also works on index 0', () => {
testRundown.unshift({ id: '0', type: SupportedEvent.Block });
const block = getRelevantBlock(testRundown as unknown as OntimeRundown, 'a');
const block = getPreviousBlock(testRundown as unknown as OntimeRundown, 'a');
expect(block?.id).toBe('0');
});
});