@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/CHANGELOG.md CHANGED
@@ -1,6 +1,3 @@
1
- # 5.0.0-32
2
- Fix: fetch bookmarks from service when logged in @iisa
3
- Fix: adjust css to help shadydom render properly @iisa
4
1
  # 5.0.0-31
5
2
  Fix: modal loads into dom from `<ia-bookreader>` @iisa
6
3
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-32",
3
+ "version": "5.0.0-32-shadydom3",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@ export default class BookmarksProvider {
16
16
  signedIn,
17
17
  bookreader,
18
18
  modal,
19
- onProviderChange,
19
+ onProviderChange
20
20
  } = options;
21
21
 
22
22
  const referrerStr = `referer=${encodeURIComponent(location.href)}`;
@@ -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(res => res.text()).then((res) => {
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
- });