@internetarchive/bookreader 5.0.0-32 → 5.0.0-32-shadydom3
Sign up to get free protection for your applications and to get access to all the features.
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +26 -26
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/CHANGELOG.md +0 -3
- package/package.json +1 -1
- package/src/BookNavigator/bookmarks/bookmarks-provider.js +1 -1
- package/src/BookNavigator/bookmarks/ia-bookmarks.js +2 -5
- package/tests/karma/BookNavigator/bookmarks/ia-bookmarks.test.js +0 -57
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -142,8 +142,8 @@ class IABookmarks extends LitElement {
|
|
142
142
|
if (this.displayMode === 'login') {
|
143
143
|
return;
|
144
144
|
}
|
145
|
-
this.fetchUserBookmarks();
|
146
145
|
this.setBREventListeners();
|
146
|
+
this.initializeBookmarks();
|
147
147
|
}
|
148
148
|
|
149
149
|
updateDisplay() {
|
@@ -153,9 +153,6 @@ class IABookmarks extends LitElement {
|
|
153
153
|
}
|
154
154
|
|
155
155
|
fetchUserBookmarks() {
|
156
|
-
if (!this.api.identifier) {
|
157
|
-
return;
|
158
|
-
}
|
159
156
|
this.fetchBookmarks()
|
160
157
|
.then(() => {
|
161
158
|
this.initializeBookmarks();
|
@@ -230,7 +227,7 @@ class IABookmarks extends LitElement {
|
|
230
227
|
}
|
231
228
|
|
232
229
|
fetchBookmarks() {
|
233
|
-
return this.api.getAll().then(
|
230
|
+
return this.api.getAll().then((res) => {
|
234
231
|
let response;
|
235
232
|
try {
|
236
233
|
response = JSON.parse(res);
|
@@ -1,57 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
html,
|
3
|
-
fixtureSync,
|
4
|
-
expect,
|
5
|
-
fixtureCleanup,
|
6
|
-
} from '@open-wc/testing';
|
7
|
-
import '../../../../src/BookNavigator/bookmarks/ia-bookmarks.js';
|
8
|
-
import sinon from 'sinon';
|
9
|
-
|
10
|
-
afterEach(() => {
|
11
|
-
sinon.restore();
|
12
|
-
fixtureCleanup();
|
13
|
-
});
|
14
|
-
|
15
|
-
describe('<ia-bookmarks>', () => {
|
16
|
-
it('uses `setup` to start component', async () => {
|
17
|
-
const el = fixtureSync(html`<ia-bookmarks></ia-bookmarks>`);
|
18
|
-
await el.updateComplete;
|
19
|
-
|
20
|
-
let fetchHappened = false;
|
21
|
-
el.bookreader.bookId = 'foo';
|
22
|
-
el.displayMode = 'bookmarks';
|
23
|
-
|
24
|
-
el.fetchBookmarks = async () => {
|
25
|
-
fetchHappened = true;
|
26
|
-
return await Promise.resolve();
|
27
|
-
};
|
28
|
-
|
29
|
-
const fetchSpy = sinon.spy(el, 'fetchUserBookmarks');
|
30
|
-
|
31
|
-
el.setup();
|
32
|
-
await el.updateComplete;
|
33
|
-
|
34
|
-
expect(fetchSpy.callCount).to.equal(1);
|
35
|
-
expect(fetchHappened).to.equal(true);
|
36
|
-
});
|
37
|
-
it('does not fetch user bookmarks if displayMode = login', async () => {
|
38
|
-
const el = fixtureSync(html`<ia-bookmarks></ia-bookmarks>`);
|
39
|
-
await el.updateComplete;
|
40
|
-
|
41
|
-
let fetchHappened = false;
|
42
|
-
el.displayMode = 'login';
|
43
|
-
|
44
|
-
el.fetchBookmarks = async () => {
|
45
|
-
fetchHappened = true;
|
46
|
-
return await Promise.resolve();
|
47
|
-
};
|
48
|
-
|
49
|
-
const fetchSpy = sinon.spy(el, 'fetchUserBookmarks');
|
50
|
-
|
51
|
-
el.setup();
|
52
|
-
await el.updateComplete;
|
53
|
-
|
54
|
-
expect(fetchSpy.callCount).to.equal(0);
|
55
|
-
expect(fetchHappened).to.equal(false);
|
56
|
-
});
|
57
|
-
});
|