@internetarchive/bookreader 5.0.0-67 → 5.0.0-68

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/BookReader/BookReader.css +53 -891
  2. package/BookReader/BookReader.js +1 -1
  3. package/BookReader/BookReader.js.map +1 -1
  4. package/BookReader/ia-bookreader-bundle.js +50 -48
  5. package/BookReader/ia-bookreader-bundle.js.map +1 -1
  6. package/BookReader/plugins/plugin.autoplay.js +1 -1
  7. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  8. package/BookReader/plugins/plugin.chapters.js +1 -1
  9. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  10. package/BookReader/plugins/plugin.search.js +1 -1
  11. package/BookReader/plugins/plugin.search.js.map +1 -1
  12. package/BookReader/plugins/plugin.text_selection.js +1 -1
  13. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  14. package/BookReader/plugins/plugin.tts.js +1 -1
  15. package/BookReader/plugins/plugin.tts.js.map +1 -1
  16. package/BookReaderDemo/BookReaderDemo.css +0 -18
  17. package/BookReaderDemo/BookReaderJSAdvanced.js +0 -3
  18. package/BookReaderDemo/demo-autoplay.html +0 -2
  19. package/BookReaderDemo/demo-fullscreen-mobile.html +1 -4
  20. package/BookReaderDemo/demo-fullscreen.html +0 -3
  21. package/BookReaderDemo/demo-iiif.js +0 -1
  22. package/BookReaderDemo/demo-vendor-fullscreen.html +0 -3
  23. package/BookReaderDemo/immersion-1up.html +0 -1
  24. package/BookReaderDemo/immersion-mode.html +0 -3
  25. package/CHANGELOG.md +5 -0
  26. package/package.json +7 -8
  27. package/src/BookReader/BookModel.js +0 -12
  28. package/src/BookReader/Mode1Up.js +1 -1
  29. package/src/BookReader/Mode1UpLit.js +1 -1
  30. package/src/BookReader/events.js +0 -1
  31. package/src/BookReader.js +1 -2
  32. package/src/css/BookReader.scss +1 -5
  33. package/src/css/_BRnav.scss +0 -8
  34. package/src/plugins/plugin.autoplay.js +1 -2
  35. package/src/plugins/search/plugin.search.js +0 -3
  36. package/tests/e2e/base.test.js +3 -11
  37. package/tests/e2e/helpers/base.js +26 -26
  38. package/tests/e2e/helpers/rightToLeft.js +4 -4
  39. package/tests/e2e/helpers/{desktopSearch.js → search.js} +19 -19
  40. package/tests/e2e/models/Navigation.js +16 -42
  41. package/tests/e2e/viewmode.test.js +3 -3
  42. package/tests/jest/plugins/plugin.chapters.test.js +0 -1
  43. package/tests/jest/plugins/search/plugin.search.view.test.js +0 -1
  44. package/webpack.config.js +0 -1
  45. package/BookReader/plugins/plugin.mobile_nav.js +0 -2
  46. package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
  47. package/src/css/_MobileNav.scss +0 -168
  48. package/src/plugins/plugin.mobile_nav.js +0 -288
  49. package/tests/e2e/helpers/mobileSearch.js +0 -85
  50. package/tests/jest/plugins/plugin.mobile_nav.test.js +0 -66
@@ -36,21 +36,3 @@ ia-bookreader{
36
36
  overflow: hidden;
37
37
  margin: 0 auto;
38
38
  }
39
-
40
- @media only screen and (max-width: 799px) {
41
- body.BRbodyMobileNavEnabled {
42
- margin: 0;
43
- width: 100%;
44
- overflow: hidden;
45
- }
46
- .BRbodyMobileNavEnabled .BookReader {
47
- top: 0;
48
- bottom: 0;
49
- left: 0;
50
- right: 0;
51
- position: absolute;
52
- height: 100%;
53
- margin: 0;
54
- width: 100%;
55
- }
56
- }
@@ -92,9 +92,6 @@ var options = {
92
92
  {label: 'Author', value: 'Internet Archive'},
93
93
  {label: 'Demo Info', value: 'This demo shows how one could use BookReader with their own content.'},
94
94
  ],
95
- // This toggles the mobile drawer (not shown in 'embed' mode)
96
- enableMobileNav: false,
97
- mobileNavTitle: 'BookReader demo',
98
95
 
99
96
  // Override the path used to find UI images
100
97
  imagesBaseURL: '../BookReader/images/',
@@ -15,8 +15,6 @@
15
15
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>
16
16
  <script src="../BookReader/BookReader.js"></script>
17
17
 
18
- <!-- Mobile nav plugin -->
19
- <script src="../BookReader/plugins/plugin.mobile_nav.js"></script>
20
18
  <!-- Autoplay plugin -->
21
19
  <script src="../BookReader/plugins/plugin.autoplay.js"></script>
22
20
 
@@ -15,9 +15,6 @@
15
15
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>
16
16
  <script src="../BookReader/BookReader.js"></script>
17
17
 
18
- <!-- Mobile nav plugin -->
19
- <script src="../BookReader/plugins/plugin.mobile_nav.js"></script>
20
-
21
18
  <!-- URL-changing plugin -->
22
19
  <script src="../BookReader/plugins/plugin.url.js"></script>
23
20
 
@@ -31,7 +28,7 @@ html, body { width: 100%; height: 100%; margin: 0; padding: 0; background: grey;
31
28
  <div id="BookReader"></div>
32
29
  <script type="text/javascript" src="BookReaderJSSimple.js"></script>
33
30
  <script>
34
- instantiateBookReader('#BookReader', {mobileNavFullscreenOnly: true});
31
+ instantiateBookReader('#BookReader');
35
32
  </script>
36
33
  </body>
37
34
  </html>
@@ -15,9 +15,6 @@
15
15
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>
16
16
  <script src="../BookReader/BookReader.js"></script>
17
17
 
18
- <!-- Mobile nav plugin -->
19
- <script src="../BookReader/plugins/plugin.mobile_nav.js"></script>
20
-
21
18
  <!-- URL-changing plugin -->
22
19
  <script src="../BookReader/plugins/plugin.url.js"></script>
23
20
 
@@ -11,7 +11,6 @@ var br = new BookReader({
11
11
 
12
12
  // Override the path used to find UI images
13
13
  imagesBaseURL: '../BookReader/images/',
14
- enableMobileNav: false,
15
14
  });
16
15
 
17
16
  br.IIIF({
@@ -15,9 +15,6 @@
15
15
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>
16
16
  <script src="../BookReader/BookReader.js"></script>
17
17
 
18
- <!-- Mobile nav plugin -->
19
- <script src="../BookReader/plugins/plugin.mobile_nav.js"></script>
20
-
21
18
  <!-- URL-changing plugin -->
22
19
  <script src="../BookReader/plugins/plugin.url.js"></script>
23
20
 
@@ -14,7 +14,6 @@
14
14
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>
15
15
 
16
16
  <!-- plugins needed for archive.org, in same order as archive.org -->
17
- <script src="../BookReader/plugins/plugin.mobile_nav.js"></script>
18
17
  <script src="../BookReader/plugins/plugin.search.js"></script>
19
18
  <script src="../BookReader/plugins/plugin.chapters.js"></script>
20
19
  <script src="../BookReader/plugins/plugin.tts.js"></script>
@@ -15,9 +15,6 @@
15
15
  <link rel="stylesheet" href="../BookReader/BookReader.css"/>
16
16
  <script src="../BookReader/BookReader.js"></script>
17
17
 
18
- <!-- Mobile nav plugin -->
19
- <script src="../BookReader/plugins/plugin.mobile_nav.js"></script>
20
-
21
18
  <!-- URL-changing plugin -->
22
19
  <script src="../BookReader/plugins/plugin.url.js"></script>
23
20
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 5.0.0-68
2
+ - Fix: 1up zoom wrong on start/entering full screen @cdrini
3
+ - Dev: BREAKING: delete `plugin.mobile_nav.js` no longer used @cdrini
4
+ - Dev: Move page 1 label correction logic to BookReaderJSIA @cdrini
5
+
1
6
  # 5.0.0-67
2
7
  - Feature: Re-enable chapters plugin + migrate off mmenu @cdrini
3
8
  - Fix: Disable tooltips on touchscreens + fix on IA @cdrini
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-67",
3
+ "version": "5.0.0-68",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "private": false,
27
27
  "dependencies": {
28
28
  "@internetarchive/ia-activity-indicator": "^0.0.4",
29
- "@internetarchive/ia-item-navigator": "^1.0.4",
29
+ "@internetarchive/ia-item-navigator": "^1.1.1",
30
30
  "@internetarchive/ia-sharing-options": "^1.0.2",
31
31
  "@internetarchive/icon-bookmark": "^1.3.4",
32
32
  "@internetarchive/icon-dl": "^1.3.4",
@@ -48,11 +48,11 @@
48
48
  "@babel/plugin-proposal-decorators": "7.22.7",
49
49
  "@babel/preset-env": "7.22.9",
50
50
  "@open-wc/testing-helpers": "^2.3.0",
51
- "@types/jest": "29.5.3",
51
+ "@types/jest": "29.5.4",
52
52
  "@webcomponents/webcomponentsjs": "^2.6.0",
53
53
  "babel-loader": "9.1.3",
54
54
  "codecov": "^3.8.3",
55
- "concurrently": "7.4.0",
55
+ "concurrently": "7.6.0",
56
56
  "core-js": "3.27.1",
57
57
  "cpx2": "4.2.3",
58
58
  "eslint": "^7.32.0",
@@ -61,16 +61,15 @@
61
61
  "http-server": "14.1.1",
62
62
  "interactjs": "^1.10.18",
63
63
  "iso-language-codes": "1.1.0",
64
- "jest": "29.6.2",
65
- "jest-environment-jsdom": "^29.4.3",
64
+ "jest": "29.6.4",
65
+ "jest-environment-jsdom": "^29.6.4",
66
66
  "jquery": "3.6.1",
67
67
  "jquery-colorbox": "1.6.4",
68
68
  "jquery-ui": "1.12.1",
69
69
  "jquery-ui-touch-punch": "0.2.3",
70
70
  "jquery.browser": "0.1.0",
71
- "jquery.mmenu": "5.6.5",
72
71
  "live-server": "1.2.2",
73
- "node-fetch": "3.2.10",
72
+ "node-fetch": "3.3.2",
74
73
  "regenerator-runtime": "0.13.11",
75
74
  "sass": "1.64.2",
76
75
  "sinon": "^15.1.0",
@@ -30,18 +30,6 @@ export class BookModel {
30
30
  this._medianPageSize = null;
31
31
  /** @type {[PageData[], number]} */
32
32
  this._getDataFlattenedCached = null;
33
-
34
- // Heal missing first page number assertion
35
- const pages = this._getDataFlattened();
36
- const firstNumberedPageIndex = pages.findIndex(page => page.pageNum != undefined && !isNaN(parseFloat(page.pageNum)));
37
- if (firstNumberedPageIndex != -1 && firstNumberedPageIndex > 0) {
38
- const pageNum = parseFloat(pages[firstNumberedPageIndex].pageNum);
39
- if (!isNaN(pageNum)) {
40
- // Note: Since the pages are always sorted in increasing pageNum/index
41
- // order, this will work for both left-to-right and right-to-left books
42
- pages[firstNumberedPageIndex - 1].pageNum = pageNum - 1;
43
- }
44
- }
45
33
  }
46
34
 
47
35
  /** Get median width/height of page in inches. Memoized for performance. */
@@ -77,7 +77,7 @@ export class Mode1Up {
77
77
  jumpToIndex(index, pageX, pageY, noAnimate) {
78
78
  // Only smooth for small distances
79
79
  const distance = Math.abs(this.br.currentIndex() - index);
80
- const smooth = !noAnimate && distance <= 4;
80
+ const smooth = !noAnimate && distance > 0 && distance <= 4;
81
81
  this.mode1UpLit.jumpToIndex(index, { smooth });
82
82
  }
83
83
 
@@ -350,7 +350,7 @@ export class Mode1UpLit extends LitElement {
350
350
  */
351
351
  computeDefaultScale(page) {
352
352
  // Default to real size if it fits, otherwise default to full width
353
- const containerWidthIn = this.coordSpace.visiblePixelsToWorldUnits(this.htmlDimensionsCacher.clientWidth);
353
+ const containerWidthIn = this.coordSpace.renderedPixelsToWorldUnits(this.clientWidth);
354
354
  return Math.min(1, containerWidthIn / (page.widthInches + 2 * this.SPACING_IN)) || 1;
355
355
  }
356
356
 
@@ -16,5 +16,4 @@ export const EVENTS = {
16
16
  '2PageViewSelected': '2PageViewSelected',
17
17
  /* currently 3 represents thumbnail view */
18
18
  '3PageViewSelected': '3PageViewSelected',
19
- mobileNavOpen: 'mobileNavOpen',
20
19
  };
package/src/BookReader.js CHANGED
@@ -1355,9 +1355,8 @@ exposeOverrideableMethod(Toolbar, '_components.toolbar', 'getToolBarHeight');
1355
1355
  */
1356
1356
  BookReader.prototype.bindNavigationHandlers = function() {
1357
1357
  const self = this;
1358
+ const jIcons = this.$('.BRicon');
1358
1359
 
1359
- // Note the mobile plugin attaches itself to body, so we need to select outside
1360
- const jIcons = this.$('.BRicon').add('.BRmobileMenu .BRicon');
1361
1360
  // Map of jIcon class -> click handler
1362
1361
  const navigationControls = {
1363
1362
  book_left: () => {
@@ -7,7 +7,6 @@ $brFontFamily: "Helvetica Neue", Arial, Verdana, sans-serif;
7
7
  $brColorThemeblue: #0074D1;
8
8
  $brColorThemeBlue2: #4990E2;
9
9
  $brColorThemeBlue3: rgb(74,144,226);
10
- $brColorThemeBlueDarker: rgb(36,94,131);
11
10
  $brColorDarkGreyBg: #333;
12
11
  $brColorMainBg: black;
13
12
 
@@ -44,13 +43,11 @@ $mediumBlue: #428bca;
44
43
  $lightBlue: #adaedc;
45
44
  $controlsText: $white;
46
45
  $controlsBG: $gray20;
47
- $iconStroke: $white;
48
46
  $tooltipBG: $gray20;
49
47
  $activeButtonBG: $white;
50
48
  $controlsBorder: $gray13;
51
49
  $trackColor: $gray40;
52
50
  $trackFillColor: $gray80;
53
- $mobileMenuBG: #151515;
54
51
 
55
52
  $tooltipBG: $gray20;
56
53
  $tooltipText: $white;
@@ -70,7 +67,7 @@ $searchResultBG: $darkBlue;
70
67
  }
71
68
 
72
69
  // These are the main root elements in BookReader
73
- $brScope: ".BookReader, .BRmobileMenu, .BRfloat";
70
+ $brScope: ".BookReader, .BRfloat";
74
71
 
75
72
  @import 'colorbox';
76
73
  @import 'BRmain';
@@ -80,7 +77,6 @@ $brScope: ".BookReader, .BRmobileMenu, .BRfloat";
80
77
  @import 'BRnav';
81
78
  @import 'BRtoolbar';
82
79
  @import 'BRsearch';
83
- @import 'MobileNav';
84
80
  @import 'BRvendor';
85
81
  @import 'icons';
86
82
  @import 'controls';
@@ -130,14 +130,6 @@
130
130
  // Default
131
131
  @include brNavDark;
132
132
 
133
- /* Full mobile styles */
134
- @media (max-width: $brBreakPointMobile) {
135
- .BRbodyMobileNavEnabled &,
136
- .BRbodyMobileNavEnabledFullscreen.BRfullscreenActive & {
137
- @include brNavLight;
138
- }
139
- }
140
-
141
133
  &--controls {
142
134
  display: flex;
143
135
  }
@@ -41,8 +41,7 @@ BookReader.prototype.bindNavigationHandlers = (function(super_) {
41
41
 
42
42
  if (!this.options.enableAutoPlayPlugin) return;
43
43
 
44
- // Note the mobile plugin attaches itself to body, so we need to select outside
45
- const jIcons = this.$('.BRicon').add('.BRmobileMenu .BRicon');
44
+ const jIcons = this.$('.BRicon');
46
45
 
47
46
  jIcons.filter('.play').click(() => {
48
47
  this.autoToggle();
@@ -2,9 +2,6 @@
2
2
  /* global BookReader */
3
3
  /**
4
4
  * Plugin for Archive.org book search
5
- * NOTE: This script must be loaded AFTER `plugin.mobile_nav.js`
6
- * as it mutates mobile nav drawer
7
- *
8
5
  * Events fired at various points throughout search processing are published
9
6
  * on the document DOM element. These can be subscribed to using jQuery's event
10
7
  * binding method `$.fn.on`. All of the events are prefixed with a BookReader
@@ -1,7 +1,6 @@
1
1
  import { runBaseTests } from './helpers/base';
2
2
  import BookReader from './models/BookReader';
3
- import { runDesktopSearchTests } from './helpers/desktopSearch';
4
- // import { runMobileSearchTests } from './helpers/mobileSearch';
3
+ import { runSearchTests } from './helpers/search';
5
4
  import params from './helpers/params';
6
5
 
7
6
  const ocaids = params.ocaids || [
@@ -22,14 +21,7 @@ ocaids.forEach(ocaid => {
22
21
  runBaseTests(new BookReader());
23
22
 
24
23
 
25
- fixture `Desktop Search Tests for: ${ocaid}`
24
+ fixture `Search Tests for: ${ocaid}`
26
25
  .page `${url}`;
27
- runDesktopSearchTests(new BookReader());
28
-
29
- // Todo: deprecated, will remove once mmenu is removed.
30
- // fixture `Mobile Search Tests for: ${ocaid}`
31
- // .page `${url}`
32
- // runMobileSearchTests(new BookReader());
33
-
34
-
26
+ runSearchTests(new BookReader());
35
27
  });
@@ -53,14 +53,14 @@ export function runBaseTests (br) {
53
53
  test('nav menu displays properly', async t => {
54
54
  const { nav } = br;
55
55
 
56
- await t.expect(nav.desktop.goLeft.visible).ok();
57
- await t.expect(nav.desktop.goRight.visible).ok();
58
- await t.expect(nav.desktop.mode1Up.visible).ok();
59
- await t.expect(nav.desktop.mode2Up.visible).ok();
60
- await t.expect(nav.desktop.modeThumb.visible).ok();
61
- await t.expect(nav.desktop.zoomIn.visible).ok();
62
- await t.expect(nav.desktop.zoomOut.visible).ok();
63
- await t.expect(nav.desktop.fullScreen.visible).ok();
56
+ await t.expect(nav.goLeft.visible).ok();
57
+ await t.expect(nav.goRight.visible).ok();
58
+ await t.expect(nav.mode1Up.visible).ok();
59
+ await t.expect(nav.mode2Up.visible).ok();
60
+ await t.expect(nav.modeThumb.visible).ok();
61
+ await t.expect(nav.zoomIn.visible).ok();
62
+ await t.expect(nav.zoomOut.visible).ok();
63
+ await t.expect(nav.fullScreen.visible).ok();
64
64
  });
65
65
 
66
66
  test("Canonical URL has no initial parameters", async t => {
@@ -87,7 +87,7 @@ export function runBaseTests (br) {
87
87
  const initialUrl = await getUrl();
88
88
 
89
89
  // Set Cookie by page navigation, wait for cookie
90
- await t.click(nav.desktop.goNext);
90
+ await t.click(nav.goNext);
91
91
  await t.wait(PAGE_FLIP_WAIT_TIME);
92
92
 
93
93
  // reload canonical URL, wait for URL change
@@ -109,9 +109,9 @@ export function runBaseTests (br) {
109
109
  const { nav, BRcontainer} = br;
110
110
 
111
111
  // Go to next page, so we can go previous if at front cover
112
- await t.click(nav.desktop.goNext);
112
+ await t.click(nav.goNext);
113
113
  await t.wait(PAGE_FLIP_WAIT_TIME);
114
- await t.click(nav.desktop.goNext);
114
+ await t.click(nav.goNext);
115
115
  await t.wait(PAGE_FLIP_WAIT_TIME);
116
116
 
117
117
  const onLoadBrState = BRcontainer.child(0);
@@ -119,7 +119,7 @@ export function runBaseTests (br) {
119
119
  const origImg1Src = await initialImages.nth(0).getAttribute('src');
120
120
  const origImg2Src = await initialImages.nth(-1).getAttribute('src');
121
121
 
122
- await t.click(nav.desktop.goPrev);
122
+ await t.click(nav.goPrev);
123
123
  await t.wait(PAGE_FLIP_WAIT_TIME);
124
124
 
125
125
  const nextBrState = Selector('.BRcontainer').child(0);
@@ -144,7 +144,7 @@ export function runBaseTests (br) {
144
144
  // Note: this will fail on a R to L book if at front cover
145
145
  const { nav, BRcontainer} = br;
146
146
  // Flip away from cover
147
- await t.click(nav.desktop.goNext);
147
+ await t.click(nav.goNext);
148
148
  await t.wait(PAGE_FLIP_WAIT_TIME);
149
149
 
150
150
  const onLoadBrState = BRcontainer.child(0);
@@ -152,7 +152,7 @@ export function runBaseTests (br) {
152
152
  const origImg1Src = await initialImages.nth(0).getAttribute('src');
153
153
  const origImg2Src = await initialImages.nth(-1).getAttribute('src');
154
154
 
155
- await t.click(nav.desktop.goNext);
155
+ await t.click(nav.goNext);
156
156
  await t.wait(PAGE_FLIP_WAIT_TIME);
157
157
 
158
158
  const nextBrState = Selector('.BRcontainer').child(0);
@@ -173,28 +173,28 @@ export function runBaseTests (br) {
173
173
  test('Clicking `page flip buttons` updates location', async t => {
174
174
  const { nav } = br;
175
175
  // Page navigation creates params
176
- await t.click(nav.desktop.goNext);
176
+ await t.click(nav.goNext);
177
177
  await t.expect(isPageInUrl()).eql(true);
178
178
  await t.expect(isModeInUrl('2up')).eql(true);
179
179
 
180
- await t.click(nav.desktop.goPrev);
180
+ await t.click(nav.goPrev);
181
181
  await t.expect(isPageInUrl()).eql(true);
182
182
  await t.expect(isModeInUrl('2up')).eql(true);
183
183
  });
184
184
 
185
185
  test('Clicking `2 page view` brings up cur page + caching', async t => {
186
186
  const { nav } = br;
187
- await t.click(nav.desktop.mode2Up);
187
+ await t.click(nav.mode2Up);
188
188
  await t.expect(Selector('.BRpagecontainer.BRpage-visible').count).eql(1);
189
189
  await t.expect(Selector('.BRpagecontainer').count).eql(3);
190
190
  });
191
191
 
192
192
  test('Clicking `1 page view` brings up 1 at a time', async t => {
193
193
  const { nav } = br;
194
- await t.click(nav.desktop.mode1Up);
194
+ await t.click(nav.mode1Up);
195
195
 
196
196
  // Flip away from cover
197
- await t.click(nav.desktop.goNext);
197
+ await t.click(nav.goNext);
198
198
  await t.wait(PAGE_FLIP_WAIT_TIME);
199
199
 
200
200
  // we usually pre-fetch the page in question & the 2 after it
@@ -203,7 +203,7 @@ export function runBaseTests (br) {
203
203
 
204
204
  test('Clicking `thumbnail view` brings up all of the page thumbnails', async t => {
205
205
  const { nav } = br;
206
- await t.click(nav.desktop.modeThumb);
206
+ await t.click(nav.modeThumb);
207
207
  await t.expect(Selector('.BRpagecontainer').count).gte(3);
208
208
  });
209
209
 
@@ -213,12 +213,12 @@ export function runBaseTests (br) {
213
213
 
214
214
  await t.expect(br.BRcontainer.visible).ok();
215
215
  await t.expect(page.visible).ok();
216
- await t.expect(nav.desktop.zoomOut.visible).ok();
216
+ await t.expect(nav.zoomOut.visible).ok();
217
217
 
218
218
  const initialBookHeight = await page.getBoundingClientRectProperty('height');
219
219
  const initialBookWidth = await page.getBoundingClientRectProperty('width');
220
220
 
221
- await t.click(nav.desktop.zoomOut);
221
+ await t.click(nav.zoomOut);
222
222
 
223
223
  const zoomOutBookHeight = await page.getBoundingClientRectProperty('height');
224
224
  const zoomOutBookWidth = await page.getBoundingClientRectProperty('width');
@@ -233,12 +233,12 @@ export function runBaseTests (br) {
233
233
 
234
234
  await t.expect(br.BRcontainer.visible).ok();
235
235
  await t.expect(page.visible).ok();
236
- await t.expect(nav.desktop.zoomIn.visible).ok();
236
+ await t.expect(nav.zoomIn.visible).ok();
237
237
 
238
238
  const initialBookHeight = await page.getBoundingClientRectProperty('height');
239
239
  const initialBookWidth = await page.getBoundingClientRectProperty('width');
240
240
 
241
- await t.click(nav.desktop.zoomIn);
241
+ await t.click(nav.zoomIn);
242
242
 
243
243
  const zoomInBookHeight = await page.getBoundingClientRectProperty('height');
244
244
  const zoomIntBookWidth = await page.getBoundingClientRectProperty('width');
@@ -253,10 +253,10 @@ export function runBaseTests (br) {
253
253
 
254
254
  // initial in-page
255
255
  await t.expect(BRcontainer.getBoundingClientRectProperty('width')).lte(windowWidth);
256
- await t.click(nav.desktop.fullScreen);
256
+ await t.click(nav.fullScreen);
257
257
  // full screen
258
258
  await t.expect(BRcontainer.getBoundingClientRectProperty('width')).eql(windowWidth);
259
- await t.click(nav.desktop.fullScreen);
259
+ await t.click(nav.fullScreen);
260
260
  // in-page
261
261
  await t.expect(BRcontainer.getBoundingClientRectProperty('width')).lte(windowWidth);
262
262
  });
@@ -4,20 +4,20 @@ const getPageUrl = ClientFunction(() => window.location.href);
4
4
  export function runRightToLeftTests (br) {
5
5
  test('Right to Left - correct initialization in two-page view', async t => {
6
6
  const { nav, BRcontainer} = br;
7
- await t.click(nav.desktop.mode2Up);
7
+ await t.click(nav.mode2Up);
8
8
 
9
9
  //checking right leaf edge is not in tree
10
10
  await t.expect(BRcontainer.find('.br-mode-2up__leafs--left').count).eql(1);
11
11
  await t.expect(BRcontainer.find('.br-mode-2up__leafs--right').count).eql(0);
12
12
 
13
13
  //checks slider is in correct position
14
- await t.expect(nav.desktop.sliderRange.getStyleProperty('width')).eql('0px');
14
+ await t.expect(nav.sliderRange.getStyleProperty('width')).eql('0px');
15
15
  });
16
16
 
17
17
  test('Right to Left - assuring flipping left goes to next page', async t => {
18
18
  const { nav } = br;
19
- await t.click(nav.desktop.mode2Up);
20
- await t.click(nav.desktop.goLeft);
19
+ await t.click(nav.mode2Up);
20
+ await t.click(nav.goLeft);
21
21
  await t.expect(getPageUrl()).match(/page\/n1/);
22
22
  });
23
23
  }
@@ -3,7 +3,7 @@ import { SEARCH_INSIDE_URL_RE , mockResponseFound, mockResponseNotFound,
3
3
  TEST_TEXT_FOUND, TEST_TEXT_NOT_FOUND, PAGE_FIRST_RESULT, SEARCH_MATCHES_LENGTH } from './mockSearch';
4
4
 
5
5
 
6
- export function runDesktopSearchTests(br) {
6
+ export function runSearchTests(br) {
7
7
  //building mock response for successful and unsuccessful search
8
8
  const mockFound = RequestMock()
9
9
  .onRequestTo(SEARCH_INSIDE_URL_RE )
@@ -15,32 +15,32 @@ export function runDesktopSearchTests(br) {
15
15
 
16
16
 
17
17
  test
18
- .requestHooks(mockFound)('Desktop search - successful search', async t => {
18
+ .requestHooks(mockFound)('Search - successful search', async t => {
19
19
  const nav = br.nav;
20
20
 
21
21
  //assuring that the search bar is enabled
22
- await t.expect(nav.desktop.searchIcon.visible).ok();
23
- await t.click(nav.desktop.searchIcon);
22
+ await t.expect(nav.searchIcon.visible).ok();
23
+ await t.click(nav.searchIcon);
24
24
 
25
25
  //testing search for a word found in the book
26
- await t.selectText(nav.desktop.searchBox).pressKey('delete');
26
+ await t.selectText(nav.searchBox).pressKey('delete');
27
27
  // FIXME: Why is it only typing every other letter?!?!
28
- await t.typeText(nav.desktop.searchBox, TEST_TEXT_FOUND.split('').join('_'));
28
+ await t.typeText(nav.searchBox, TEST_TEXT_FOUND.split('').join('_'));
29
29
  await t.pressKey('enter');
30
30
 
31
- await t.expect(nav.desktop.searchPin.exists).ok();
32
- await t.expect(nav.desktop.searchPin.child('.BRquery').child('main').exists).ok();
33
- await t.expect(nav.desktop.searchPin.child('.BRquery').child('main').innerText).contains(TEST_TEXT_FOUND);
34
- await t.expect(nav.desktop.searchNavigation.exists).ok();
35
- await t.expect(nav.desktop.searchNavigation.find('[data-id="resultsCount"]').exists).ok();
36
- await t.expect(nav.desktop.searchNavigation.find('[data-id="resultsCount"]').innerText).contains(SEARCH_MATCHES_LENGTH);
31
+ await t.expect(nav.searchPin.exists).ok();
32
+ await t.expect(nav.searchPin.child('.BRquery').child('main').exists).ok();
33
+ await t.expect(nav.searchPin.child('.BRquery').child('main').innerText).contains(TEST_TEXT_FOUND);
34
+ await t.expect(nav.searchNavigation.exists).ok();
35
+ await t.expect(nav.searchNavigation.find('[data-id="resultsCount"]').exists).ok();
36
+ await t.expect(nav.searchNavigation.find('[data-id="resultsCount"]').innerText).contains(SEARCH_MATCHES_LENGTH);
37
37
 
38
38
  //checking url
39
39
  const getPageUrl = ClientFunction(() => window.location.href.toString());
40
40
  await t.expect(getPageUrl()).contains(TEST_TEXT_FOUND);
41
41
 
42
42
  //checks clicking on first search pin opens correct page
43
- await t.click(nav.desktop.searchPin);
43
+ await t.click(nav.searchPin);
44
44
  await t.expect(getPageUrl()).contains(PAGE_FIRST_RESULT);
45
45
 
46
46
  //checks highlight on result page is visible
@@ -51,19 +51,19 @@ export function runDesktopSearchTests(br) {
51
51
 
52
52
 
53
53
  test
54
- .requestHooks(mockNotFound)('Desktop search - unsuccessful search', async t => {
54
+ .requestHooks(mockNotFound)('Search - unsuccessful search', async t => {
55
55
  const nav = br.nav;
56
56
 
57
57
  //assuring that the search bar is enabled
58
- await t.expect(nav.desktop.searchIcon.visible).ok();
59
- await t.click(nav.desktop.searchIcon);
58
+ await t.expect(nav.searchIcon.visible).ok();
59
+ await t.click(nav.searchIcon);
60
60
 
61
61
  //testing search for a word not found in the book
62
- await t.selectText(nav.desktop.searchBox).pressKey('delete');
62
+ await t.selectText(nav.searchBox).pressKey('delete');
63
63
  // FIXME: Why is it only typing every other letter?!?!
64
- await t.typeText(nav.desktop.searchBox, TEST_TEXT_NOT_FOUND.split('').join('_'));
64
+ await t.typeText(nav.searchBox, TEST_TEXT_NOT_FOUND.split('').join('_'));
65
65
  await t.pressKey('enter');
66
- await t.expect(nav.desktop.searchPin.child('.BRquery').child('main').withText(TEST_TEXT_NOT_FOUND).exists).notOk();
66
+ await t.expect(nav.searchPin.child('.BRquery').child('main').withText(TEST_TEXT_NOT_FOUND).exists).notOk();
67
67
 
68
68
  const getPageUrl = ClientFunction(() => window.location.href.toString());
69
69
  await t.expect(getPageUrl()).contains(TEST_TEXT_NOT_FOUND);