Commit 5e49f9b8 authored by Robert Knight's avatar Robert Knight

Rename `BucketBar.element`

The name was vestigial. Rename it to `_bucketsContainer` to be more
meaningful and indicate that it is private. Several other private fields
have also been prefixed accordingly.
parent e1eaca4a
...@@ -11,6 +11,10 @@ import { ListenerCollection } from './util/listener-collection'; ...@@ -11,6 +11,10 @@ import { ListenerCollection } from './util/listener-collection';
* at should be contained within this element. * at should be contained within this element.
*/ */
/**
* Controller for the "bucket bar" shown alongside the sidebar indicating where
* annotations are in the document.
*/
export default class BucketBar { export default class BucketBar {
/** /**
* @param {HTMLElement} container * @param {HTMLElement} container
...@@ -19,10 +23,11 @@ export default class BucketBar { ...@@ -19,10 +23,11 @@ export default class BucketBar {
*/ */
constructor(container, guest, { contentContainer = document.body } = {}) { constructor(container, guest, { contentContainer = document.body } = {}) {
this._contentContainer = contentContainer; this._contentContainer = contentContainer;
this.element = document.createElement('div');
this.guest = guest; this._bucketsContainer = document.createElement('div');
container.appendChild(this.element); container.appendChild(this._bucketsContainer);
this._guest = guest;
this._listeners = new ListenerCollection(); this._listeners = new ListenerCollection();
...@@ -36,7 +41,7 @@ export default class BucketBar { ...@@ -36,7 +41,7 @@ export default class BucketBar {
destroy() { destroy() {
this._listeners.removeAll(); this._listeners.removeAll();
this.element.remove(); this._bucketsContainer.remove();
} }
update() { update() {
...@@ -51,17 +56,17 @@ export default class BucketBar { ...@@ -51,17 +56,17 @@ export default class BucketBar {
} }
_update() { _update() {
const buckets = anchorBuckets(this.guest.anchors); const buckets = anchorBuckets(this._guest.anchors);
render( render(
<Buckets <Buckets
above={buckets.above} above={buckets.above}
below={buckets.below} below={buckets.below}
buckets={buckets.buckets} buckets={buckets.buckets}
onSelectAnnotations={(annotations, toggle) => onSelectAnnotations={(annotations, toggle) =>
this.guest.selectAnnotations(annotations, toggle) this._guest.selectAnnotations(annotations, toggle)
} }
/>, />,
this.element this._bucketsContainer
); );
} }
} }
...@@ -51,7 +51,7 @@ describe('BucketBar', () => { ...@@ -51,7 +51,7 @@ describe('BucketBar', () => {
it('should render buckets for existing anchors when constructed', () => { it('should render buckets for existing anchors when constructed', () => {
const bucketBar = createBucketBar(); const bucketBar = createBucketBar();
assert.calledWith(fakeBucketUtil.anchorBuckets, fakeAnnotator.anchors); assert.calledWith(fakeBucketUtil.anchorBuckets, fakeAnnotator.anchors);
assert.ok(bucketBar.element.querySelector('.FakeBuckets')); assert.ok(bucketBar._bucketsContainer.querySelector('.FakeBuckets'));
}); });
describe('updating buckets', () => { describe('updating buckets', () => {
......
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