Commit 61f238ea authored by Robert Knight's avatar Robert Knight

Always capture EPUBContentSelector, PageSelector in VitalSource books

In preparation for enabling the `book_as_single_document` feature for everyone,
enable capturing the EPUBContentSelector selector whether the feature flag is
enabled or not.

Once this is released, all new VS annotations will have all the data they will
need after they are migrated to the new format [1] and only the annotation URL
will need to be changed. This will leave us with only a fixed set of older
annotations for which we will need to obtain the missing CFI and chapter title
data.

[1] See https://github.com/hypothesis/h/issues/7709
parent 2448bc52
...@@ -360,11 +360,6 @@ describe('annotator/integrations/vitalsource', () => { ...@@ -360,11 +360,6 @@ describe('annotator/integrations/vitalsource', () => {
assert.calledWith(fakeHTMLIntegration.scrollToAnchor, anchor); assert.calledWith(fakeHTMLIntegration.scrollToAnchor, anchor);
}); });
context('when "book_as_single_document" flag is on', () => {
beforeEach(() => {
featureFlags.update({ book_as_single_document: true });
});
it('adds selector for current EPUB book Content Document', async () => { it('adds selector for current EPUB book Content Document', async () => {
const integration = createIntegration(); const integration = createIntegration();
integration.contentContainer(); integration.contentContainer();
...@@ -373,9 +368,7 @@ describe('annotator/integrations/vitalsource', () => { ...@@ -373,9 +368,7 @@ describe('annotator/integrations/vitalsource', () => {
const range = new Range(); const range = new Range();
const selectors = await integration.describe(range); const selectors = await integration.describe(range);
const cfiSelector = selectors.find( const cfiSelector = selectors.find(s => s.type === 'EPUBContentSelector');
s => s.type === 'EPUBContentSelector'
);
assert.ok(cfiSelector); assert.ok(cfiSelector);
assert.deepEqual(cfiSelector, { assert.deepEqual(cfiSelector, {
...@@ -398,9 +391,7 @@ describe('annotator/integrations/vitalsource', () => { ...@@ -398,9 +391,7 @@ describe('annotator/integrations/vitalsource', () => {
const range = new Range(); const range = new Range();
const selectors = await integration.describe(range); const selectors = await integration.describe(range);
const cfiSelector = selectors.find( const cfiSelector = selectors.find(s => s.type === 'EPUBContentSelector');
s => s.type === 'EPUBContentSelector'
);
assert.ok(cfiSelector); assert.ok(cfiSelector);
assert.deepEqual(cfiSelector, { assert.deepEqual(cfiSelector, {
...@@ -418,7 +409,6 @@ describe('annotator/integrations/vitalsource', () => { ...@@ -418,7 +409,6 @@ describe('annotator/integrations/vitalsource', () => {
label: '2', label: '2',
}); });
}); });
});
describe('#getMetadata', () => { describe('#getMetadata', () => {
context('when "book_as_single_document" flag is off', () => { context('when "book_as_single_document" flag is off', () => {
......
...@@ -320,9 +320,6 @@ export class VitalSourceContentIntegration ...@@ -320,9 +320,6 @@ export class VitalSourceContentIntegration
async describe(root: HTMLElement, range: Range) { async describe(root: HTMLElement, range: Range) {
const selectors: Selector[] = this._htmlIntegration.describe(root, range); const selectors: Selector[] = this._htmlIntegration.describe(root, range);
if (!this._bookIsSingleDocument()) {
return selectors;
}
const { const {
cfi, cfi,
......
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