@internetarchive/ia-book-actions 0.0.5-4-01 → 0.0.5-a1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.0.5-4-01",
3
+ "version": "0.0.5-a1",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -61,6 +61,8 @@ export class BookTitleBar extends ActionsHandler {
61
61
  return css`
62
62
  :host {
63
63
  padding: 0 10px;
64
+ height: 3.4rem;
65
+ display: flex;
64
66
  }
65
67
  .embed-link {
66
68
  display: inline-flex;
@@ -68,7 +70,6 @@ export class BookTitleBar extends ActionsHandler {
68
70
  text-decoration: none;
69
71
  color: var(--primaryTextColor, #fff);
70
72
  font-size: 1.4rem;
71
- height: 3.4rem;
72
73
  }
73
74
  .embed-link .title {
74
75
  display: -webkit-box;
@@ -76,9 +77,11 @@ export class BookTitleBar extends ActionsHandler {
76
77
  -webkit-line-clamp: 2;
77
78
  overflow: hidden;
78
79
  text-align: left;
80
+ line-height: initial;
79
81
  }
80
82
  .embed-link svg {
81
83
  margin-right: 0.5rem;
84
+ display: block;
82
85
  }
83
86
  .embed-link:hover {
84
87
  text-decoration: underline;
@@ -151,9 +151,6 @@ export default class ActionsHandler extends LitElement {
151
151
  handleReadItNow(extraParam) {
152
152
  const currentParams = new URLSearchParams(window.location.search);
153
153
 
154
- // Delete the ?q= parameter just after borrow a book. see: WEBDEV-3979
155
- currentParams.delete('q');
156
-
157
154
  if (extraParam) {
158
155
  // append extraParam key-value in currentParams
159
156
  const extraParams = new URLSearchParams(extraParam);
@@ -33,7 +33,7 @@ export default class IABookActions extends LitElement {
33
33
  this.lendingStatus = {};
34
34
  this.width = 0;
35
35
  this.bwbPurchaseUrl = '';
36
- this.barType = 'action';
36
+ this.barType = 'action'; // 'title'|'action'
37
37
  this.sharedObserver = undefined;
38
38
  this.primaryActions = [];
39
39
  this.primaryTitle = '';
@@ -1,4 +1,4 @@
1
- import { html, fixture, expect } from '@open-wc/testing';
1
+ import { html, fixture, expect, oneEvent } from '@open-wc/testing';
2
2
  import '../../src/components/book-title-bar.js';
3
3
 
4
4
  const container = ({ identifier, bookTitle } = {}) =>
@@ -19,4 +19,21 @@ describe('<book-title-bar>', () => {
19
19
  expect(link.innerText).to.equal('this is test booktitle');
20
20
  expect(link.getAttribute('href')).to.equal('/details/goody');
21
21
  });
22
+
23
+ it('check if event if firing on valid analytics category action', async () => {
24
+ const el = await fixture(
25
+ container({
26
+ identifier: 'goody',
27
+ bookTitle: 'this is test booktitle',
28
+ })
29
+ );
30
+
31
+ const clickButton = () =>
32
+ el.shadowRoot.querySelector('a').dispatchEvent(new Event('click'));
33
+ setTimeout(clickButton);
34
+
35
+ const { detail } = await oneEvent(el, 'bookTitleBar');
36
+ expect(detail.event.category).to.equal('BookReader-Header');
37
+ expect(detail.event.action).to.equal('Book-Title-Bar');
38
+ });
22
39
  });