Commit 62557943 authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Removed references to 'plugin.BucketBar'

BucketBar is not used anymore as a plugin.
parent 4677e16f
...@@ -152,6 +152,9 @@ export default class Guest extends Delegator { ...@@ -152,6 +152,9 @@ export default class Guest extends Delegator {
this.plugins = {}; this.plugins = {};
/** @typedef {import('./bucket-bar').default|null} */
this.bucketBar = null;
/** @type {Anchor[]} */ /** @type {Anchor[]} */
this.anchors = []; this.anchors = [];
...@@ -483,7 +486,7 @@ export default class Guest extends Delegator { ...@@ -483,7 +486,7 @@ export default class Guest extends Delegator {
this.anchors = this.anchors.concat(anchors); this.anchors = this.anchors.concat(anchors);
// Let plugins know about the new information. // Let plugins know about the new information.
this.plugins.BucketBar?.update(); this.bucketBar?.update();
this.plugins.CrossFrame?.sync([annotation]); this.plugins.CrossFrame?.sync([annotation]);
return anchors; return anchors;
...@@ -543,7 +546,7 @@ export default class Guest extends Delegator { ...@@ -543,7 +546,7 @@ export default class Guest extends Delegator {
this.anchors = anchors; this.anchors = anchors;
removeHighlights(unhighlight); removeHighlights(unhighlight);
this.plugins.BucketBar?.update(); this.bucketBar?.update();
} }
/** /**
......
...@@ -78,7 +78,7 @@ export default class Sidebar extends Guest { ...@@ -78,7 +78,7 @@ export default class Sidebar extends Guest {
if (config.theme === 'clean') { if (config.theme === 'clean') {
frame.classList.add('annotator-frame--theme-clean'); frame.classList.add('annotator-frame--theme-clean');
} else { } else {
this.plugins.BucketBar = new BucketBar(frame, this, config.BucketBar); this.bucketbar = new BucketBar(frame, this, config.BucketBar);
} }
// Undocumented switch to enable/disable the wrapping of the sidebar inside a shadow DOM // Undocumented switch to enable/disable the wrapping of the sidebar inside a shadow DOM
......
...@@ -770,10 +770,10 @@ describe('Guest', () => { ...@@ -770,10 +770,10 @@ describe('Guest', () => {
it('updates the cross frame and bucket bar plugins', () => { it('updates the cross frame and bucket bar plugins', () => {
const guest = createGuest(); const guest = createGuest();
guest.plugins.CrossFrame = { sync: sinon.stub() }; guest.plugins.CrossFrame = { sync: sinon.stub() };
guest.plugins.BucketBar = { update: sinon.stub() }; guest.bucketBar = { update: sinon.stub() };
const annotation = {}; const annotation = {};
return guest.anchor(annotation).then(() => { return guest.anchor(annotation).then(() => {
assert.called(guest.plugins.BucketBar.update); assert.called(guest.bucketBar.update);
assert.called(guest.plugins.CrossFrame.sync); assert.called(guest.plugins.CrossFrame.sync);
}); });
}); });
...@@ -852,13 +852,13 @@ describe('Guest', () => { ...@@ -852,13 +852,13 @@ describe('Guest', () => {
it('updates the bucket bar plugin', () => { it('updates the bucket bar plugin', () => {
const guest = createGuest(); const guest = createGuest();
guest.plugins.BucketBar = { update: sinon.stub() }; guest.bucketBar = { update: sinon.stub() };
const annotation = {}; const annotation = {};
guest.anchors.push({ annotation }); guest.anchors.push({ annotation });
guest.detach(annotation); guest.detach(annotation);
assert.calledOnce(guest.plugins.BucketBar.update); assert.calledOnce(guest.bucketBar.update);
}); });
it('removes any highlights associated with the annotation', () => { it('removes any highlights associated with the annotation', () => {
......
...@@ -81,15 +81,13 @@ describe('Sidebar', () => { ...@@ -81,15 +81,13 @@ describe('Sidebar', () => {
const fakeBucketBar = {}; const fakeBucketBar = {};
fakeBucketBar.element = document.createElement('div'); fakeBucketBar.element = document.createElement('div');
fakeBucketBar.destroy = sandbox.stub(); fakeBucketBar.destroy = sandbox.stub();
const BucketBar = sandbox.stub();
BucketBar.returns(fakeBucketBar);
CrossFrame = sandbox.stub(); CrossFrame = sandbox.stub();
CrossFrame.returns(fakeCrossFrame); CrossFrame.returns(fakeCrossFrame);
const BucketBar = sandbox.stub();
BucketBar.returns(fakeBucketBar);
sidebarConfig.pluginClasses.CrossFrame = CrossFrame; sidebarConfig.pluginClasses.CrossFrame = CrossFrame;
sidebarConfig.pluginClasses.BucketBar = BucketBar;
sidebars = []; sidebars = [];
...@@ -97,6 +95,7 @@ describe('Sidebar', () => { ...@@ -97,6 +95,7 @@ describe('Sidebar', () => {
'./toolbar': { './toolbar': {
ToolbarController: FakeToolbarController, ToolbarController: FakeToolbarController,
}, },
'./bucket-bar': { default: BucketBar },
}); });
}); });
...@@ -788,16 +787,16 @@ describe('Sidebar', () => { ...@@ -788,16 +787,16 @@ describe('Sidebar', () => {
}); });
describe('config', () => { describe('config', () => {
it('does not have the BucketBar plugin if the clean theme is enabled', () => { it('does not have the BucketBar if the clean theme is enabled', () => {
const sidebar = createSidebar({ theme: 'clean' }); const sidebar = createSidebar({ theme: 'clean' });
assert.isUndefined(sidebar.plugins.BucketBar); assert.isNull(sidebar.bucketBar);
}); });
it('does not have the BucketBar if an external container is provided', () => { it('does not have the BucketBar if an external container is provided', () => {
const sidebar = createSidebar({ const sidebar = createSidebar({
externalContainerSelector: `.${EXTERNAL_CONTAINER_SELECTOR}`, externalContainerSelector: `.${EXTERNAL_CONTAINER_SELECTOR}`,
}); });
assert.isUndefined(sidebar.plugins.BucketBar); assert.isNull(sidebar.bucketBar);
}); });
it('disables shadow DOM if `disableShadowSidebar` flag is set', () => { it('disables shadow DOM if `disableShadowSidebar` flag is set', () => {
......
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