Commit c19a5a25 authored by Robert Knight's avatar Robert Knight

Rename `showOutsideAssignmentNotice` -> `setOutsideAssignmentNoticeVisible`

The new name is verbose, but it makes it more obvious how the call functions.
parent a02eaffe
......@@ -586,9 +586,12 @@ export class Guest extends TinyEmitter implements Annotator, Destroyable {
this._integration.showContentInfo?.(info),
);
this._sidebarRPC.on('showOutsideAssignmentNotice', (show: boolean) => {
this._showOutsideAssignmentNotice(show);
});
this._sidebarRPC.on(
'setOutsideAssignmentNoticeVisible',
(show: boolean) => {
this._setOutsideAssignmentNoticeVisible(show);
},
);
this._sidebarRPC.on('navigateToSegment', (annotation: AnnotationData) =>
this._integration.navigateToSegment?.(annotation),
......@@ -925,13 +928,14 @@ export class Guest extends TinyEmitter implements Annotator, Destroyable {
/**
* Handle a potential shortcut trigger.
*/
_handleShortcut(event: KeyboardEvent) {
private _handleShortcut(event: KeyboardEvent) {
if (matchShortcut(event, 'Ctrl+Shift+H')) {
this.setHighlightsVisible(!this._highlightsVisible);
}
}
_showOutsideAssignmentNotice(show: boolean) {
/** Show or hide banner warning user they are outside page range for assignment. */
private _setOutsideAssignmentNoticeVisible(show: boolean) {
if (!this._outsideAssignmentNotice) {
this._outsideAssignmentNotice = new OutsideAssignmentNoticeController(
this.element,
......
......@@ -606,11 +606,11 @@ describe('Guest', () => {
});
});
describe('on "showOutsideAssignmentNotice" event', () => {
describe('on "setOutsideAssignmentNoticeVisible" event', () => {
[true, false].forEach(arg => {
it('shows notice if argument is `true`', () => {
createGuest();
emitSidebarEvent('showOutsideAssignmentNotice', arg);
emitSidebarEvent('setOutsideAssignmentNoticeVisible', arg);
assert.calledWith(fakeOutsideAssignmentNotice.setVisible, arg);
});
});
......
......@@ -370,7 +370,7 @@ export class FrameSyncService {
info.segmentInfo,
focusFilters,
);
guestRPC.call('showOutsideAssignmentNotice', !match);
guestRPC.call('setOutsideAssignmentNoticeVisible', !match);
}
this._store.connectFrame({
......
......@@ -468,7 +468,7 @@ describe('FrameSyncService', () => {
it('is not displayed if no focus filter is configured', async () => {
await connectEPUBGuest();
assert.isFalse(
guestRPC().call.calledWith('showOutsideAssignmentNotice'),
guestRPC().call.calledWith('setOutsideAssignmentNoticeVisible'),
);
});
......@@ -477,7 +477,7 @@ describe('FrameSyncService', () => {
await connectEPUBGuest();
assert.calledWith(
guestRPC().call,
'showOutsideAssignmentNotice',
'setOutsideAssignmentNoticeVisible',
false,
);
});
......@@ -487,7 +487,7 @@ describe('FrameSyncService', () => {
await connectEPUBGuest();
assert.calledWith(
guestRPC().call,
'showOutsideAssignmentNotice',
'setOutsideAssignmentNoticeVisible',
true,
);
});
......
......@@ -144,7 +144,7 @@ export type SidebarToGuestEvent =
* Show a notice that the user is outside the region of the document for the
* current activity / assignment.
*/
| 'showOutsideAssignmentNotice';
| 'setOutsideAssignmentNoticeVisible';
/**
* Events that the sidebar sends to the host
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment