@internetarchive/bookreader 5.0.0-10-alpha-3 → 5.0.0-101
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/BookReader/474.js +2 -0
- package/BookReader/474.js.map +1 -0
- package/BookReader/BookReader.css +431 -1134
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.LICENSE.txt +20 -20
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/bergamot-translator-worker.js +2966 -0
- package/BookReader/bergamot-translator-worker.wasm +0 -0
- package/BookReader/hypothesis/LICENSE +50 -0
- package/BookReader/hypothesis/README.md +55 -0
- package/BookReader/hypothesis/build/boot.js +1 -0
- package/BookReader/hypothesis/build/manifest.json +20 -0
- package/BookReader/hypothesis/build/scripts/annotator.bundle.js +184 -0
- package/BookReader/hypothesis/build/scripts/annotator.bundle.js.map +1 -0
- package/BookReader/hypothesis/build/scripts/sidebar.bundle.js +798 -0
- package/BookReader/hypothesis/build/scripts/sidebar.bundle.js.map +1 -0
- package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js +711 -0
- package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js.map +1 -0
- package/BookReader/hypothesis/build/styles/annotator.css +2235 -0
- package/BookReader/hypothesis/build/styles/annotator.css.map +1 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/BookReader/hypothesis/build/styles/highlights.css +2 -0
- package/BookReader/hypothesis/build/styles/highlights.css.map +1 -0
- package/BookReader/hypothesis/build/styles/katex.min.css +2 -0
- package/BookReader/hypothesis/build/styles/katex.min.css.map +1 -0
- package/BookReader/hypothesis/build/styles/pdfjs-overrides.css +2 -0
- package/BookReader/hypothesis/build/styles/pdfjs-overrides.css.map +1 -0
- package/BookReader/hypothesis/build/styles/sidebar.css +2731 -0
- package/BookReader/hypothesis/build/styles/sidebar.css.map +1 -0
- package/BookReader/hypothesis/build/styles/ui-playground.css +2659 -0
- package/BookReader/hypothesis/build/styles/ui-playground.css.map +1 -0
- package/BookReader/hypothesis/package.json +126 -0
- package/BookReader/ia-bookreader-bundle.js +1782 -0
- package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +7 -0
- package/BookReader/ia-bookreader-bundle.js.map +1 -0
- package/BookReader/icons/1up.svg +1 -1
- package/BookReader/icons/2up.svg +1 -1
- package/BookReader/icons/advance.svg +1 -1
- package/BookReader/icons/chevron-right.svg +1 -1
- package/BookReader/icons/close-circle-dark.svg +1 -1
- package/BookReader/icons/close-circle.svg +1 -1
- package/BookReader/icons/fullscreen.svg +1 -1
- package/BookReader/icons/fullscreen_exit.svg +1 -1
- package/BookReader/icons/hamburger.svg +1 -1
- package/BookReader/icons/left-arrow.svg +1 -1
- package/BookReader/icons/magnify-minus.svg +1 -1
- package/BookReader/icons/magnify-plus.svg +1 -1
- package/BookReader/icons/magnify.svg +1 -1
- package/BookReader/icons/pause.svg +1 -1
- package/BookReader/icons/play.svg +1 -1
- package/BookReader/icons/playback-speed.svg +1 -1
- package/BookReader/icons/read-aloud.svg +1 -1
- package/BookReader/icons/review.svg +1 -1
- package/BookReader/icons/thumbnails.svg +1 -1
- package/BookReader/icons/voice.svg +1 -0
- package/BookReader/icons/volume-full.svg +1 -1
- package/BookReader/images/BRicons.svg +3 -3
- package/BookReader/images/books_graphic.svg +1 -1
- package/BookReader/images/hypothesis.ico +0 -0
- package/BookReader/images/icon_book.svg +1 -1
- package/BookReader/images/icon_bookmark.svg +1 -1
- package/BookReader/images/icon_experiment.svg +1 -0
- package/BookReader/images/icon_gear.svg +1 -1
- package/BookReader/images/icon_hamburger.svg +1 -1
- package/BookReader/images/icon_home.svg +1 -1
- package/BookReader/images/icon_info.svg +1 -1
- package/BookReader/images/icon_one_page.svg +1 -1
- package/BookReader/images/icon_pause.svg +1 -1
- package/BookReader/images/icon_play.svg +1 -1
- package/BookReader/images/icon_playback-rate.svg +1 -1
- package/BookReader/images/icon_search_button.svg +1 -1
- package/BookReader/images/icon_share.svg +1 -1
- package/BookReader/images/icon_skip-ahead.svg +1 -1
- package/BookReader/images/icon_skip-back.svg +1 -1
- package/BookReader/images/icon_speaker.svg +1 -1
- package/BookReader/images/icon_speaker_open.svg +1 -1
- package/BookReader/images/icon_thumbnails.svg +1 -1
- package/BookReader/images/icon_toc.svg +1 -1
- package/BookReader/images/icon_two_pages.svg +1 -1
- package/BookReader/images/marker_chap-off.svg +1 -1
- package/BookReader/images/marker_chap-on.svg +1 -1
- package/BookReader/images/marker_srch-on.svg +1 -1
- package/BookReader/images/translate.svg +1 -0
- package/BookReader/images/unviewable_page.png +0 -0
- package/BookReader/jquery-3.js +2 -0
- package/BookReader/jquery-3.js.LICENSE.txt +24 -0
- package/BookReader/plugins/plugin.archive_analytics.js +1 -1
- package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
- package/BookReader/plugins/plugin.autoplay.js +1 -1
- package/BookReader/plugins/plugin.autoplay.js.map +1 -1
- package/BookReader/plugins/plugin.chapters.js +25 -1
- package/BookReader/plugins/plugin.chapters.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.experiments.js +3 -0
- package/BookReader/plugins/plugin.experiments.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.experiments.js.map +1 -0
- package/BookReader/plugins/plugin.iframe.js +1 -1
- package/BookReader/plugins/plugin.iframe.js.map +1 -1
- package/BookReader/plugins/plugin.iiif.js +2 -0
- package/BookReader/plugins/plugin.iiif.js.map +1 -0
- package/BookReader/plugins/plugin.resume.js +1 -1
- package/BookReader/plugins/plugin.resume.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +2 -1
- package/BookReader/plugins/plugin.search.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +2 -1
- package/BookReader/plugins/plugin.text_selection.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.translate.js +137 -0
- package/BookReader/plugins/plugin.translate.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.translate.js.map +1 -0
- package/BookReader/plugins/plugin.tts.js +1 -1
- package/BookReader/plugins/plugin.tts.js.LICENSE.txt +2 -0
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/BookReader/plugins/plugin.url.js +1 -1
- package/BookReader/plugins/plugin.url.js.map +1 -1
- package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -1
- package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
- package/BookReader/plugins/translator-worker.js +2 -0
- package/BookReader/plugins/translator-worker.js.map +1 -0
- package/BookReader/silence.mp3 +0 -0
- package/BookReader/translator-worker.js +475 -0
- package/BookReader/webcomponents-bundle.js +3 -0
- package/BookReader/webcomponents-bundle.js.LICENSE.txt +9 -0
- package/BookReader/webcomponents-bundle.js.map +1 -0
- package/README.md +14 -3
- package/jsconfig.json +19 -0
- package/package.json +84 -64
- package/src/BookNavigator/assets/bookmark-colors.js +1 -1
- package/src/BookNavigator/assets/button-base.js +2 -1
- package/src/BookNavigator/assets/ia-logo.js +17 -0
- package/src/BookNavigator/assets/icon_checkmark.js +1 -1
- package/src/BookNavigator/assets/icon_close.js +1 -1
- package/src/BookNavigator/book-navigator.js +620 -0
- package/src/BookNavigator/bookmarks/bookmark-button.js +3 -2
- package/src/BookNavigator/bookmarks/bookmark-edit.js +2 -3
- package/src/BookNavigator/bookmarks/bookmarks-list.js +2 -3
- package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +2 -2
- package/src/BookNavigator/bookmarks/bookmarks-provider.js +27 -17
- package/src/BookNavigator/bookmarks/ia-bookmarks.js +116 -67
- package/src/BookNavigator/delete-modal-actions.js +1 -1
- package/src/BookNavigator/downloads/downloads-provider.js +36 -21
- package/src/BookNavigator/downloads/downloads.js +24 -4
- package/src/BookNavigator/search/search-provider.js +55 -27
- package/src/BookNavigator/search/search-results.js +25 -11
- package/src/BookNavigator/sharing.js +27 -0
- package/src/BookNavigator/viewable-files.js +95 -0
- package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +13 -12
- package/src/BookNavigator/visual-adjustments/visual-adjustments.js +9 -9
- package/src/BookReader/BookModel.js +92 -46
- package/src/BookReader/DragScrollable.js +233 -0
- package/src/BookReader/ImageCache.js +49 -16
- package/src/BookReader/Mode1Up.js +58 -360
- package/src/BookReader/Mode1UpLit.js +393 -0
- package/src/BookReader/Mode2Up.js +75 -1318
- package/src/BookReader/Mode2UpLit.js +787 -0
- package/src/BookReader/ModeCoordinateSpace.js +29 -0
- package/src/BookReader/ModeSmoothZoom.js +312 -0
- package/src/BookReader/ModeThumb.js +20 -12
- package/src/BookReader/Navbar/Navbar.js +130 -53
- package/src/BookReader/PageContainer.js +120 -23
- package/src/BookReader/ReduceSet.js +2 -2
- package/src/BookReader/Toolbar/Toolbar.js +18 -40
- package/src/BookReader/events.js +2 -3
- package/src/BookReader/options.js +87 -16
- package/src/BookReader/utils/HTMLDimensionsCacher.js +44 -0
- package/src/BookReader/utils/ScrollClassAdder.js +31 -0
- package/src/BookReader/utils/SelectionObserver.js +45 -0
- package/src/BookReader/utils/classes.js +1 -1
- package/src/BookReader/utils.js +136 -12
- package/src/BookReader.js +641 -1192
- package/src/BookReaderPlugin.js +52 -0
- package/src/assets/icons/magnify-minus.svg +3 -7
- package/src/assets/icons/magnify-plus.svg +3 -7
- package/src/assets/icons/voice.svg +1 -0
- package/src/assets/images/hypothesis.ico +0 -0
- package/src/assets/images/icon_experiment.svg +1 -0
- package/src/assets/images/translate.svg +1 -0
- package/src/assets/images/unviewable_page.png +0 -0
- package/src/assets/silence.mp3 +0 -0
- package/src/css/BookReader.scss +1 -5
- package/src/css/_BRBookmarks.scss +1 -1
- package/src/css/_BRComponent.scss +1 -1
- package/src/css/_BRicon.scss +8 -2
- package/src/css/_BRmain.scss +16 -3
- package/src/css/_BRnav.scss +12 -66
- package/src/css/_BRpages.scss +171 -42
- package/src/css/_BRsearch.scss +69 -30
- package/src/css/_BRtoolbar.scss +5 -5
- package/src/css/_TextSelection.scss +129 -24
- package/src/css/_colorbox.scss +2 -2
- package/src/css/_controls.scss +24 -7
- package/src/css/_icons.scss +1 -1
- package/src/ia-bookreader/ia-bookreader.js +224 -0
- package/src/plugins/plugin.archive_analytics.js +84 -78
- package/src/plugins/plugin.autoplay.js +99 -104
- package/src/plugins/plugin.chapters.js +314 -205
- package/src/plugins/plugin.experiments.js +321 -0
- package/src/plugins/plugin.iframe.js +1 -1
- package/src/plugins/plugin.iiif.js +141 -0
- package/src/plugins/plugin.resume.js +54 -51
- package/src/plugins/plugin.text_selection.js +510 -219
- package/src/plugins/plugin.vendor-fullscreen.js +5 -5
- package/src/plugins/search/plugin.search.js +370 -392
- package/src/plugins/search/utils.js +43 -0
- package/src/plugins/search/view.js +49 -67
- package/src/plugins/translate/TranslationManager.js +162 -0
- package/src/plugins/translate/plugin.translate.js +523 -0
- package/src/plugins/tts/AbstractTTSEngine.js +78 -49
- package/src/plugins/tts/FestivalTTSEngine.js +20 -30
- package/src/plugins/tts/PageChunk.js +33 -21
- package/src/plugins/tts/PageChunkIterator.js +11 -17
- package/src/plugins/tts/WebTTSEngine.js +131 -91
- package/src/plugins/tts/plugin.tts.js +344 -350
- package/src/plugins/tts/utils.js +49 -47
- package/src/plugins/url/UrlPlugin.js +191 -0
- package/src/plugins/{plugin.url.js → url/plugin.url.js} +44 -15
- package/src/util/TextSelectionManager.js +282 -0
- package/src/util/browserSniffing.js +33 -1
- package/src/util/cache.js +20 -0
- package/src/util/docCookies.js +21 -2
- package/src/util/strings.js +1 -0
- package/.babelrc +0 -12
- package/.dependabot/config.yml +0 -6
- package/.eslintrc.js +0 -50
- package/.gitattributes +0 -2
- package/.github/ISSUE_TEMPLATE/bug.md +0 -32
- package/.github/ISSUE_TEMPLATE/feature-request.md +0 -30
- package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -15
- package/.github/workflows/node.js.yml +0 -37
- package/.github/workflows/npm-publish.yml +0 -47
- package/.testcaferc.json +0 -5
- package/BookReader/bookreader-component-bundle.js +0 -1450
- package/BookReader/bookreader-component-bundle.js.LICENSE.txt +0 -38
- package/BookReader/bookreader-component-bundle.js.map +0 -1
- package/BookReader/jquery-1.10.1.js +0 -2
- package/BookReader/jquery-1.10.1.js.LICENSE.txt +0 -24
- package/BookReader/plugins/plugin.menu_toggle.js +0 -2
- package/BookReader/plugins/plugin.menu_toggle.js.map +0 -1
- package/BookReader/plugins/plugin.mobile_nav.js +0 -2
- package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
- package/BookReaderDemo/BookReaderDemo.css +0 -41
- package/BookReaderDemo/BookReaderJSAdvanced.js +0 -115
- package/BookReaderDemo/BookReaderJSAutoplay.js +0 -56
- package/BookReaderDemo/BookReaderJSSimple.js +0 -55
- package/BookReaderDemo/IIIFBookReader.js +0 -207
- package/BookReaderDemo/assets/v5/Bookreader-logo-cool-grad.svg +0 -1
- package/BookReaderDemo/assets/v5/Bookreader-logo-flat.svg +0 -1
- package/BookReaderDemo/assets/v5/Bookreader-logo-hex-cool-grad.png +0 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-hex-flat.png +0 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-lines.png +0 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-lines.svg +0 -1
- package/BookReaderDemo/assets/v5/Bookreader-logo-warm.svg +0 -1
- package/BookReaderDemo/assets/v5/bookreader-logo-renders@1x.png +0 -0
- package/BookReaderDemo/assets/v5/bookreader-logo-renders@2x.png +0 -0
- package/BookReaderDemo/assets/v5/bookreader-v5-screenshot.png +0 -0
- package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
- package/BookReaderDemo/demo-advanced.html +0 -33
- package/BookReaderDemo/demo-autoplay.html +0 -38
- package/BookReaderDemo/demo-embed-iframe-src.html +0 -84
- package/BookReaderDemo/demo-embed.html +0 -26
- package/BookReaderDemo/demo-fullscreen-mobile.html +0 -36
- package/BookReaderDemo/demo-fullscreen.html +0 -33
- package/BookReaderDemo/demo-iiif.html +0 -34
- package/BookReaderDemo/demo-iiif.js +0 -26
- package/BookReaderDemo/demo-internetarchive.html +0 -74
- package/BookReaderDemo/demo-multiple.html +0 -43
- package/BookReaderDemo/demo-plugin-menu-toggle.html +0 -34
- package/BookReaderDemo/demo-preview-pages.html +0 -1092
- package/BookReaderDemo/demo-simple.html +0 -34
- package/BookReaderDemo/demo-vendor-fullscreen.html +0 -36
- package/BookReaderDemo/immersion-1up.html +0 -64
- package/BookReaderDemo/immersion-mode.html +0 -35
- package/BookReaderDemo/toggle_controls.html +0 -53
- package/BookReaderDemo/view_mode.html +0 -39
- package/BookReaderDemo/viewmode-cycle.html +0 -41
- package/CHANGELOG.md +0 -493
- package/CONTRIBUTING.md +0 -7
- package/codecov.yml +0 -17
- package/index.html +0 -31
- package/karma.conf.js +0 -23
- package/screenshot.png +0 -0
- package/scripts/postversion.js +0 -10
- package/scripts/preversion.js +0 -14
- package/scripts/version.js +0 -26
- package/src/BookNavigator/BookModel.js +0 -14
- package/src/BookNavigator/BookNavigator.js +0 -446
- package/src/BookNavigator/assets/book-loader.js +0 -27
- package/src/BookNavigator/br-fullscreen-mgr.js +0 -83
- package/src/BookNavigator/search/a-search-result.js +0 -55
- package/src/BookReader/DebugConsole.js +0 -54
- package/src/BookReaderComponent/BookReaderComponent.js +0 -112
- package/src/ItemNavigator/ItemNavigator.js +0 -376
- package/src/ItemNavigator/providers/sharing.js +0 -29
- package/src/css/_MobileNav.scss +0 -194
- package/src/dragscrollable-br.js +0 -261
- package/src/plugins/menu_toggle/plugin.menu_toggle.js +0 -324
- package/src/plugins/plugin.mobile_nav.js +0 -287
- package/tests/BookReader/BookModel.test.js +0 -312
- package/tests/BookReader/BookReaderPublicFunctions.test.js +0 -171
- package/tests/BookReader/DebugConsole.test.js +0 -25
- package/tests/BookReader/ImageCache.test.js +0 -150
- package/tests/BookReader/Mode1Up.test.js +0 -164
- package/tests/BookReader/Mode2Up.test.js +0 -247
- package/tests/BookReader/Navbar/Navbar.test.js +0 -169
- package/tests/BookReader/PageContainer.test.js +0 -115
- package/tests/BookReader/ReduceSet.test.js +0 -38
- package/tests/BookReader/Toolbar/Toolbar.test.js +0 -26
- package/tests/BookReader/utils/classes.test.js +0 -88
- package/tests/BookReader/utils.test.js +0 -109
- package/tests/BookReader.options.test.js +0 -39
- package/tests/BookReader.test.js +0 -301
- package/tests/e2e/README.md +0 -75
- package/tests/e2e/autoplay.test.js +0 -13
- package/tests/e2e/base.test.js +0 -35
- package/tests/e2e/helpers/base.js +0 -263
- package/tests/e2e/helpers/debug.js +0 -13
- package/tests/e2e/helpers/desktopSearch.js +0 -72
- package/tests/e2e/helpers/mobileSearch.js +0 -85
- package/tests/e2e/helpers/mockSearch.js +0 -93
- package/tests/e2e/helpers/rightToLeft.js +0 -29
- package/tests/e2e/ia-production/ia-prod-base.js +0 -17
- package/tests/e2e/models/BookReader.js +0 -11
- package/tests/e2e/models/Navigation.js +0 -56
- package/tests/e2e/rightToLeft.test.js +0 -20
- package/tests/e2e/viewmode.test.js +0 -37
- package/tests/karma/BookNavigator/book-navigator.test.js +0 -132
- package/tests/karma/BookNavigator/bookmarks/bookmark-edit.test.js +0 -133
- package/tests/karma/BookNavigator/bookmarks/bookmarks-list.test.js +0 -222
- package/tests/karma/BookNavigator/search/search-provider.test.js +0 -23
- package/tests/karma/BookNavigator/search/search-results.test.js +0 -240
- package/tests/karma/BookNavigator/visual-adjustments.test.js +0 -201
- package/tests/plugins/menu_toggle/plugin.menu_toggle.test.js +0 -68
- package/tests/plugins/plugin.archive_analytics.test.js +0 -23
- package/tests/plugins/plugin.autoplay.test.js +0 -52
- package/tests/plugins/plugin.chapters.test.js +0 -130
- package/tests/plugins/plugin.iframe.test.js +0 -42
- package/tests/plugins/plugin.mobile_nav.test.js +0 -66
- package/tests/plugins/plugin.resume.test.js +0 -98
- package/tests/plugins/plugin.text_selection.test.js +0 -203
- package/tests/plugins/plugin.url.test.js +0 -129
- package/tests/plugins/plugin.vendor-fullscreen.test.js +0 -65
- package/tests/plugins/search/plugin.search.test.js +0 -173
- package/tests/plugins/search/plugin.search.view.test.js +0 -106
- package/tests/plugins/tts/AbstractTTSEngine.test.js +0 -153
- package/tests/plugins/tts/FestivalTTSEngine.test.js +0 -59
- package/tests/plugins/tts/PageChunk.test.js +0 -57
- package/tests/plugins/tts/PageChunkIterator.test.js +0 -179
- package/tests/plugins/tts/WebTTSEngine.test.js +0 -126
- package/tests/plugins/tts/utils.test.js +0 -133
- package/tests/util/browserSniffing.test.js +0 -56
- package/tests/util/docCookies.test.js +0 -15
- package/tests/util/strings.test.js +0 -63
- package/tests/utils.js +0 -42
- package/webpack.config.js +0 -86
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import { ClientFunction, Selector } from 'testcafe';
|
|
2
|
-
|
|
3
|
-
const PAGE_FLIP_WAIT_TIME = 1000;
|
|
4
|
-
|
|
5
|
-
const getHash = ClientFunction(() => document.location.hash);
|
|
6
|
-
const getUrl = ClientFunction(() => window.location.href);
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Check URL page parameter in # and path
|
|
10
|
-
*/
|
|
11
|
-
const isPageInUrl = ClientFunction(() => {
|
|
12
|
-
const hash = document.location.hash;
|
|
13
|
-
if (hash) {
|
|
14
|
-
return hash.indexOf('#page/') > -1;
|
|
15
|
-
} else {
|
|
16
|
-
return window.location.href.indexOf('/page/') > -1;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Check URL mode parameter in # and path
|
|
22
|
-
*
|
|
23
|
-
* @param mode '1up', '2up', 'thumb'
|
|
24
|
-
*/
|
|
25
|
-
const isModeInUrl = ClientFunction((mode) => {
|
|
26
|
-
const hash = document.location.hash;
|
|
27
|
-
if (hash) {
|
|
28
|
-
return hash.indexOf('/mode/' + mode) > -1;
|
|
29
|
-
} else {
|
|
30
|
-
return window.location.href.indexOf('/mode/' + mode) > -1;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Runs all expected base tests for BookReader
|
|
36
|
-
*
|
|
37
|
-
* @param { import('../models/BookReader').default } br - Model
|
|
38
|
-
*/
|
|
39
|
-
export function runBaseTests (br) {
|
|
40
|
-
test('On load, pages fit fully inside of the BookReader™', async t => {
|
|
41
|
-
await t.expect(br.shell.visible).ok();
|
|
42
|
-
await t.expect(br.BRcontainer.visible).ok();
|
|
43
|
-
|
|
44
|
-
const shellHeight = await br.shell.getBoundingClientRectProperty('height');
|
|
45
|
-
const bookHeight = await br.BRcontainer.getBoundingClientRectProperty('height');
|
|
46
|
-
await t.expect(bookHeight).lte(shellHeight, 'images do not get cropped vertically');
|
|
47
|
-
|
|
48
|
-
const shellWidth = await br.shell.getBoundingClientRectProperty('width');
|
|
49
|
-
const bookWidth = await br.BRcontainer.getBoundingClientRectProperty('width');
|
|
50
|
-
await t.expect(bookWidth).lte(shellWidth, 'images do not get cropped horizontally');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test('nav menu displays properly', async t => {
|
|
54
|
-
const { nav } = br;
|
|
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();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test("Canonical URL has no initial parameters", async t => {
|
|
67
|
-
// Initial URL has no params
|
|
68
|
-
await t.expect(getHash()).eql('');
|
|
69
|
-
// Initial URL has no page/ mode/
|
|
70
|
-
await t.expect(getUrl()).notContains('#page/');
|
|
71
|
-
await t.expect(getUrl()).notContains('/page/');
|
|
72
|
-
await t.expect(getUrl()).notContains('/mode/');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// Need to disable page caching to have cookies persist in test
|
|
76
|
-
test.disablePageCaching('Canonical URL shows parameters if cookie set', async t => {
|
|
77
|
-
const { nav } = br;
|
|
78
|
-
|
|
79
|
-
// Check if uses plugin.resume.js
|
|
80
|
-
const usesResume = ClientFunction(() => {
|
|
81
|
-
const hasResumePlugin = typeof(br.getResumeValue) !== "undefined";
|
|
82
|
-
const hasResumeValue = hasResumePlugin ? br.getResumeValue() : false;
|
|
83
|
-
return hasResumeValue;
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// Store initial URL
|
|
87
|
-
const initialUrl = await getUrl();
|
|
88
|
-
|
|
89
|
-
// Set Cookie by page navigation, wait for cookie
|
|
90
|
-
await t.click(nav.desktop.goNext);
|
|
91
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
|
92
|
-
|
|
93
|
-
// reload canonical URL, wait for URL change
|
|
94
|
-
await t.navigateTo(initialUrl);
|
|
95
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
|
96
|
-
|
|
97
|
-
if (await usesResume()) {
|
|
98
|
-
await t.expect(isPageInUrl()).eql(true, initialUrl);
|
|
99
|
-
await t.expect(isModeInUrl('2up')).eql(true, initialUrl);
|
|
100
|
-
} else {
|
|
101
|
-
// No plugin, no br-resume cookie
|
|
102
|
-
await t.expect(getUrl()).notContains('#page/');
|
|
103
|
-
await t.expect(getUrl()).notContains('/page/');
|
|
104
|
-
await t.expect(getUrl()).notContains('/mode/');
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test('2up mode - Clicking `Previous page` changes the page', async t => {
|
|
109
|
-
const { nav, BRcontainer} = br;
|
|
110
|
-
|
|
111
|
-
// Go to next page, so we can go previous if at front cover
|
|
112
|
-
await t.click(nav.desktop.goNext);
|
|
113
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
|
114
|
-
await t.click(nav.desktop.goNext);
|
|
115
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
|
116
|
-
|
|
117
|
-
const onLoadBrState = BRcontainer.child(0);
|
|
118
|
-
const initialImages = onLoadBrState.find('img');
|
|
119
|
-
const origImg1Src = await initialImages.nth(0).getAttribute('src');
|
|
120
|
-
const origImg2Src = await initialImages.nth(-1).getAttribute('src');
|
|
121
|
-
|
|
122
|
-
await t.click(nav.desktop.goPrev);
|
|
123
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
|
124
|
-
|
|
125
|
-
const nextBrState = Selector('.BRcontainer').child(0);
|
|
126
|
-
const prevImages = nextBrState.find('img');
|
|
127
|
-
const prevImg1Src = await prevImages.nth(0).getAttribute('src');
|
|
128
|
-
const prevImg2Src = await prevImages.nth(-1).getAttribute('src');
|
|
129
|
-
|
|
130
|
-
// we aren't showing the same image in both leaves
|
|
131
|
-
await t.expect(origImg1Src).notEql(origImg2Src);
|
|
132
|
-
|
|
133
|
-
// we are showing new pages
|
|
134
|
-
await t.expect(prevImg1Src).notEql(origImg1Src);
|
|
135
|
-
await t.expect(prevImg1Src).notEql(origImg2Src);
|
|
136
|
-
await t.expect(prevImg2Src).notEql(origImg1Src);
|
|
137
|
-
await t.expect(prevImg2Src).notEql(origImg2Src);
|
|
138
|
-
|
|
139
|
-
// we aren't showing the same image in the new pages
|
|
140
|
-
await t.expect(prevImg1Src).notEql(prevImg2Src);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
test('2up mode - Clicking `Next page` changes the page', async t => {
|
|
144
|
-
// Note: this will fail on a R to L book if at front cover
|
|
145
|
-
const { nav, BRcontainer} = br;
|
|
146
|
-
// Flip away from cover
|
|
147
|
-
await t.click(nav.desktop.goNext);
|
|
148
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
|
149
|
-
|
|
150
|
-
const onLoadBrState = BRcontainer.child(0);
|
|
151
|
-
const initialImages = onLoadBrState.find('img');
|
|
152
|
-
const origImg1Src = await initialImages.nth(0).getAttribute('src');
|
|
153
|
-
const origImg2Src = await initialImages.nth(-1).getAttribute('src');
|
|
154
|
-
|
|
155
|
-
await t.click(nav.desktop.goNext);
|
|
156
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
|
157
|
-
|
|
158
|
-
const nextBrState = Selector('.BRcontainer').child(0);
|
|
159
|
-
const nextImages = nextBrState.find('img');
|
|
160
|
-
const nextImg1Src = await nextImages.nth(0).getAttribute('src');
|
|
161
|
-
const nextImg2Src = await nextImages.nth(-1).getAttribute('src');
|
|
162
|
-
|
|
163
|
-
// we are showing new pages
|
|
164
|
-
await t.expect(nextImg1Src).notEql(origImg1Src);
|
|
165
|
-
await t.expect(nextImg1Src).notEql(origImg2Src);
|
|
166
|
-
await t.expect(nextImg2Src).notEql(origImg1Src);
|
|
167
|
-
await t.expect(nextImg2Src).notEql(origImg2Src);
|
|
168
|
-
|
|
169
|
-
// we aren't showing the same image in the new pages
|
|
170
|
-
await t.expect(nextImg1Src).notEql(nextImg2Src);
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
test('Clicking `page flip buttons` updates location', async t => {
|
|
174
|
-
const { nav } = br;
|
|
175
|
-
// Page navigation creates params
|
|
176
|
-
await t.click(nav.desktop.goNext);
|
|
177
|
-
await t.expect(isPageInUrl()).eql(true);
|
|
178
|
-
await t.expect(isModeInUrl('2up')).eql(true);
|
|
179
|
-
|
|
180
|
-
await t.click(nav.desktop.goPrev);
|
|
181
|
-
await t.expect(isPageInUrl()).eql(true);
|
|
182
|
-
await t.expect(isModeInUrl('2up')).eql(true);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
test('Clicking `2 page view` brings up 2 pages at a time', async t => {
|
|
186
|
-
const { nav } = br;
|
|
187
|
-
await t.click(nav.desktop.mode2Up);
|
|
188
|
-
await t.expect(Selector('.BRpagecontainer').count).eql(2);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
test('Clicking `1 page view` brings up 1 at a time', async t => {
|
|
192
|
-
const { nav } = br;
|
|
193
|
-
await t.click(nav.desktop.mode1Up);
|
|
194
|
-
|
|
195
|
-
// Flip away from cover
|
|
196
|
-
await t.click(nav.desktop.goNext);
|
|
197
|
-
await t.wait(PAGE_FLIP_WAIT_TIME);
|
|
198
|
-
|
|
199
|
-
// we usually pre-fetch the page in question & the 2 after it
|
|
200
|
-
await t.expect(Selector('.BRpagecontainer').count).gte(3);
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
test('Clicking `thumbnail view` brings up all of the page thumbnails', async t => {
|
|
204
|
-
const { nav } = br;
|
|
205
|
-
await t.click(nav.desktop.modeThumb);
|
|
206
|
-
await t.expect(Selector('.BRpagecontainer').count).gte(3);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test('Clicking `zoom out` makes book smaller', async t => {
|
|
210
|
-
const { nav, BRcontainer } = br;
|
|
211
|
-
const book = BRcontainer.child(0);
|
|
212
|
-
|
|
213
|
-
await t.expect(br.BRcontainer.visible).ok();
|
|
214
|
-
await t.expect(book.visible).ok();
|
|
215
|
-
await t.expect(nav.desktop.zoomOut.visible).ok();
|
|
216
|
-
|
|
217
|
-
const initialBookHeight = await book.getBoundingClientRectProperty('height');
|
|
218
|
-
const initialBookWidth = await book.getBoundingClientRectProperty('width');
|
|
219
|
-
|
|
220
|
-
await t.click(nav.desktop.zoomOut);
|
|
221
|
-
|
|
222
|
-
const zoomOutBookHeight = await book.getBoundingClientRectProperty('height');
|
|
223
|
-
const zoomOutBookWidth = await book.getBoundingClientRectProperty('width');
|
|
224
|
-
|
|
225
|
-
await t.expect(zoomOutBookHeight).lte(initialBookHeight);
|
|
226
|
-
await t.expect(zoomOutBookWidth).lte(initialBookWidth);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test('Clicking `zoom in` makes book larger', async t => {
|
|
230
|
-
const { nav, BRcontainer } = br;
|
|
231
|
-
|
|
232
|
-
const book = await BRcontainer.child(0);
|
|
233
|
-
|
|
234
|
-
await t.expect(BRcontainer.visible).ok();
|
|
235
|
-
await t.expect(book.visible).ok();
|
|
236
|
-
await t.expect(nav.desktop.zoomIn.visible).ok();
|
|
237
|
-
|
|
238
|
-
const initialBookHeight = await book.getBoundingClientRectProperty('height');
|
|
239
|
-
const initialBookWidth = await book.getBoundingClientRectProperty('width');
|
|
240
|
-
|
|
241
|
-
await t.click(nav.desktop.zoomIn);
|
|
242
|
-
|
|
243
|
-
const zoomInBookHeight = await book.getBoundingClientRectProperty('height');
|
|
244
|
-
const zoomIntBookWidth = await book.getBoundingClientRectProperty('width');
|
|
245
|
-
|
|
246
|
-
await t.expect(zoomInBookHeight).gt(initialBookHeight);
|
|
247
|
-
await t.expect(zoomIntBookWidth).gt(initialBookWidth);
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
test('Clicking `full screen button` and BookReader fills browser window', async (t) => {
|
|
251
|
-
const { nav, BRcontainer } = br;
|
|
252
|
-
const windowWidth = await ClientFunction(() => window.innerWidth)();
|
|
253
|
-
|
|
254
|
-
// initial in-page
|
|
255
|
-
await t.expect(BRcontainer.getBoundingClientRectProperty('width')).lte(windowWidth);
|
|
256
|
-
await t.click(nav.desktop.fullScreen);
|
|
257
|
-
// full screen
|
|
258
|
-
await t.expect(BRcontainer.getBoundingClientRectProperty('width')).eql(windowWidth);
|
|
259
|
-
await t.click(nav.desktop.fullScreen);
|
|
260
|
-
// in-page
|
|
261
|
-
await t.expect(BRcontainer.getBoundingClientRectProperty('width')).lte(windowWidth);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enables a debugging breakpoint in TestCafe tests
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* import debug from './helpers/debug';
|
|
6
|
-
*
|
|
7
|
-
* test(`does a thing`, async (t) => {
|
|
8
|
-
* await debug(t);
|
|
9
|
-
* });
|
|
10
|
-
*/
|
|
11
|
-
export default async (t) => {
|
|
12
|
-
await t.debug().setNativeDialogHandler(() => true);
|
|
13
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { ClientFunction, RequestMock } from 'testcafe';
|
|
2
|
-
import { SEARCH_INSIDE_URL_RE , mockResponseFound, mockResponseNotFound,
|
|
3
|
-
TEST_TEXT_FOUND, TEST_TEXT_NOT_FOUND, PAGE_FIRST_RESULT, SEARCH_MATCHES_LENGTH } from './mockSearch';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function runDesktopSearchTests(br) {
|
|
7
|
-
//building mock response for successful and unsuccessful search
|
|
8
|
-
const mockFound = RequestMock()
|
|
9
|
-
.onRequestTo(SEARCH_INSIDE_URL_RE )
|
|
10
|
-
.respond(mockResponseFound, 202);
|
|
11
|
-
|
|
12
|
-
const mockNotFound = RequestMock()
|
|
13
|
-
.onRequestTo(SEARCH_INSIDE_URL_RE )
|
|
14
|
-
.respond(mockResponseNotFound, 202);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
test
|
|
18
|
-
.requestHooks(mockFound)('Desktop search - successful search', async t => {
|
|
19
|
-
const nav = br.nav;
|
|
20
|
-
|
|
21
|
-
//assuring that the search bar is enabled
|
|
22
|
-
await t.expect(nav.desktop.searchBox.visible).ok();
|
|
23
|
-
|
|
24
|
-
//testing search for a word found in the book
|
|
25
|
-
await t
|
|
26
|
-
.selectText(nav.desktop.searchBox.child('.BRsearchInput'))
|
|
27
|
-
.pressKey('delete');
|
|
28
|
-
await t.typeText(nav.desktop.searchBox.child('.BRsearchInput'), TEST_TEXT_FOUND);
|
|
29
|
-
await t.click((nav.desktop.searchBox).child('.BRsearchSubmit'));
|
|
30
|
-
await t.expect(nav.desktop.searchPin.exists).ok();
|
|
31
|
-
await t.expect(nav.desktop.searchPin.child('.BRquery').child('div').exists).ok();
|
|
32
|
-
await t.expect(nav.desktop.searchPin.child('.BRquery').child('div').innerText).contains(TEST_TEXT_FOUND);
|
|
33
|
-
await t.expect(nav.desktop.searchNavigation.exists).ok();
|
|
34
|
-
await t.expect(nav.desktop.searchNavigation.find('[data-id="resultsCount"]').exists).ok();
|
|
35
|
-
await t.expect(nav.desktop.searchNavigation.find('[data-id="resultsCount"]').innerText).contains(SEARCH_MATCHES_LENGTH);
|
|
36
|
-
|
|
37
|
-
//checking url
|
|
38
|
-
const getPageUrl = ClientFunction(() => window.location.href.toString());
|
|
39
|
-
await t.expect(getPageUrl()).contains(TEST_TEXT_FOUND);
|
|
40
|
-
|
|
41
|
-
//checks clicking on first search pin opens correct page
|
|
42
|
-
await t.click(nav.desktop.searchPin);
|
|
43
|
-
await t.expect(getPageUrl()).contains(PAGE_FIRST_RESULT);
|
|
44
|
-
|
|
45
|
-
//checks highlight on result page is visible
|
|
46
|
-
const highlight = br.shell.find(".BookReaderSearchHilite");
|
|
47
|
-
await t.expect(highlight.visible).ok();
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
test
|
|
53
|
-
.requestHooks(mockNotFound)('Desktop search - unsuccessful search', async t => {
|
|
54
|
-
const nav = br.nav;
|
|
55
|
-
|
|
56
|
-
//assuring that the search bar is enabled
|
|
57
|
-
await t.expect(nav.desktop.searchBox.visible).ok();
|
|
58
|
-
|
|
59
|
-
//testing search for a word not found in the book
|
|
60
|
-
await t
|
|
61
|
-
.selectText(nav.desktop.searchBox.child('.BRsearchInput'))
|
|
62
|
-
.pressKey('delete');
|
|
63
|
-
await t.typeText(nav.desktop.searchBox.child('.BRsearchInput'), TEST_TEXT_NOT_FOUND);
|
|
64
|
-
await t.click((nav.desktop.searchBox).child('.BRsearchSubmit'));
|
|
65
|
-
await t.expect(nav.desktop.searchPin.child('.BRquery').child('div').withText(TEST_TEXT_NOT_FOUND).exists).notOk();
|
|
66
|
-
|
|
67
|
-
const getPageUrl = ClientFunction(() => window.location.href.toString());
|
|
68
|
-
await t.expect(getPageUrl()).contains(TEST_TEXT_NOT_FOUND);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { ClientFunction, RequestMock } from 'testcafe';
|
|
2
|
-
import { SEARCH_INSIDE_URL_RE , mockResponseFound, mockResponseNotFound,
|
|
3
|
-
TEST_TEXT_FOUND, TEST_TEXT_NOT_FOUND, PAGE_FIRST_RESULT } from './mockSearch';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function runMobileSearchTests(br) {
|
|
7
|
-
//building mock response for successful and unsuccessful search
|
|
8
|
-
const mockFound = RequestMock()
|
|
9
|
-
.onRequestTo(SEARCH_INSIDE_URL_RE )
|
|
10
|
-
.respond(mockResponseFound, 202);
|
|
11
|
-
|
|
12
|
-
const mockNotFound = RequestMock()
|
|
13
|
-
.onRequestTo(SEARCH_INSIDE_URL_RE )
|
|
14
|
-
.respond(mockResponseNotFound, 202);
|
|
15
|
-
|
|
16
|
-
test
|
|
17
|
-
.requestHooks(mockFound)('Mobile search - successful search', async t => {
|
|
18
|
-
await t.resizeWindowToFitDevice('Sony Xperia Z', {portraitOrientation: true});
|
|
19
|
-
const nav = br.nav.mobile;
|
|
20
|
-
|
|
21
|
-
//opening side menu and search
|
|
22
|
-
await t.expect(nav.hamburgerButton.visible).ok();
|
|
23
|
-
await t.click(nav.hamburgerButton);
|
|
24
|
-
await t.expect(nav.menuSearchButton.visible).ok();
|
|
25
|
-
await t.click(nav.menuSearchButton);
|
|
26
|
-
|
|
27
|
-
//assuring that the search bar is enabled
|
|
28
|
-
await t.expect(nav.searchBox.visible).ok();
|
|
29
|
-
|
|
30
|
-
//testing successful search
|
|
31
|
-
await t
|
|
32
|
-
.selectText(nav.searchBox.find('[name="query"]'))
|
|
33
|
-
.pressKey('delete');
|
|
34
|
-
await t
|
|
35
|
-
.typeText(nav.searchBox.find('[name="query"]'), TEST_TEXT_FOUND)
|
|
36
|
-
.pressKey('enter');
|
|
37
|
-
await t.expect(nav.searchResults.visible).ok();
|
|
38
|
-
await t.expect(nav.searchResultText.exists).ok();
|
|
39
|
-
await t.expect(nav.searchResultText.innerText).contains(TEST_TEXT_FOUND);
|
|
40
|
-
|
|
41
|
-
//checking url
|
|
42
|
-
const getPageUrl = ClientFunction(() => window.location.href);
|
|
43
|
-
await t.expect(getPageUrl()).contains(TEST_TEXT_FOUND);
|
|
44
|
-
|
|
45
|
-
//checks clicking on first search result opens correct page
|
|
46
|
-
await t.click(nav.searchResults.child(0));
|
|
47
|
-
await t.expect(getPageUrl()).contains(PAGE_FIRST_RESULT);
|
|
48
|
-
|
|
49
|
-
//checks highlight on result page is visible
|
|
50
|
-
const highlight = br.shell.find(".BookReaderSearchHilite");
|
|
51
|
-
await t.expect(highlight.visible).ok();
|
|
52
|
-
|
|
53
|
-
await t.maximizeWindow();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test
|
|
57
|
-
.requestHooks(mockNotFound)('Mobile search - unsuccessful search', async t => {
|
|
58
|
-
await t.resizeWindowToFitDevice('Sony Xperia Z', {portraitOrientation: true});
|
|
59
|
-
const nav = br.nav.mobile;
|
|
60
|
-
|
|
61
|
-
//opening side menu and search
|
|
62
|
-
await t.expect(nav.hamburgerButton.visible).ok();
|
|
63
|
-
await t.click(nav.hamburgerButton);
|
|
64
|
-
await t.expect(nav.menuSearchButton.visible).ok();
|
|
65
|
-
await t.click(nav.menuSearchButton);
|
|
66
|
-
|
|
67
|
-
//assuring that the search bar is enabled
|
|
68
|
-
await t.expect(nav.searchBox.visible).ok();
|
|
69
|
-
|
|
70
|
-
//testing unsuccessful search
|
|
71
|
-
await t
|
|
72
|
-
.selectText(nav.searchBox.find('[name="query"]'))
|
|
73
|
-
.pressKey('delete');
|
|
74
|
-
await t
|
|
75
|
-
.typeText(nav.searchBox.find('[name="query"]'), TEST_TEXT_NOT_FOUND)
|
|
76
|
-
.pressKey('enter');
|
|
77
|
-
await t.expect(nav.searchResultText.withText(TEST_TEXT_NOT_FOUND).exists).notOk();
|
|
78
|
-
|
|
79
|
-
//checking url
|
|
80
|
-
const getPageUrl = ClientFunction(() => window.location.href.toString());
|
|
81
|
-
await t.expect(getPageUrl()).contains(TEST_TEXT_NOT_FOUND);
|
|
82
|
-
await t.maximizeWindow();
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
export const TEST_TEXT_FOUND = 'theory';
|
|
2
|
-
export const TEST_TEXT_NOT_FOUND = 'HopefullyNotFoundLongWord';
|
|
3
|
-
export const PAGE_FIRST_RESULT = 30;
|
|
4
|
-
|
|
5
|
-
export const SEARCH_INSIDE_URL_RE = /https:\/\/ia[0-9]+\.us\.archive\.org\/fulltext\/inside\.php\?item_id=.*/;
|
|
6
|
-
|
|
7
|
-
//adding jQueryxxxxxxxx-xxxxxxxx (semi-random numbers) from request url to returned search request object
|
|
8
|
-
/** Mock response for a matching search term. */
|
|
9
|
-
export function mockResponseFound(req, res) {
|
|
10
|
-
const requestUrl = new URL(req.url);
|
|
11
|
-
const jqueryUrl = requestUrl.searchParams.get("callback");
|
|
12
|
-
const wholeString = jqueryUrl + '(' + JSON.stringify(MOCKED_RESPONSE_FOUND) + ')';
|
|
13
|
-
res.setBody(wholeString);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** Mock response for a matching search term. */
|
|
17
|
-
export function mockResponseNotFound(req, res) {
|
|
18
|
-
const requestUrl = new URL(req.url);
|
|
19
|
-
const jqueryUrl = requestUrl.searchParams.get("callback");
|
|
20
|
-
const wholeString = jqueryUrl + '(' + JSON.stringify(MOCKED_RESPONSE_NOT_FOUND) + ')';
|
|
21
|
-
res.setBody(wholeString);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const PAGE_FIRST_RESULT_ADJUSTED = PAGE_FIRST_RESULT + 12;
|
|
25
|
-
//mocked objects inside an unsuccessful search and of a random successful search returned by search requests
|
|
26
|
-
const MOCKED_RESPONSE_NOT_FOUND = {
|
|
27
|
-
"ia": "theworksofplato01platiala",
|
|
28
|
-
"q": TEST_TEXT_NOT_FOUND,
|
|
29
|
-
"indexed": true,
|
|
30
|
-
"page_count": 1,
|
|
31
|
-
"body_length": 666,
|
|
32
|
-
"leaf0_missing": true,
|
|
33
|
-
"matches": []
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const MOCKED_RESPONSE_FOUND = {
|
|
37
|
-
"ia": "This request has been mocked",
|
|
38
|
-
"q": TEST_TEXT_FOUND,
|
|
39
|
-
"indexed": true,
|
|
40
|
-
"page_count": 644,
|
|
41
|
-
"body_length": 666,
|
|
42
|
-
"leaf0_missing": false,
|
|
43
|
-
"matches": [
|
|
44
|
-
{
|
|
45
|
-
"text": "Everybody knows the story of another experimental philosopher who had a great {{{" + TEST_TEXT_FOUND + "}}} about a horse being able to live without eating, and who demonstrated it so well, that he got his own horse down to a straw a day, and would unquestionably have rendered him a very spirited and rampacious animal on nothing at all, if he had not died, four-and-twenty hours before he was to have had his first comfortable bait of air. Unfortunately for the experimental philosophy of the female to whose protecting care Oliver Twist was delivered over, a similar result usually attended the operation of her system; for at the very moment when a child had contrived to exist upon the smallest possible portion of the weakest possible food, it did perversely happen in eight and a half cases out of ten, either that it sickened from want and cold, or fell into the fire from neglect, or got half-smothered by accident; in any one of which cases, the miserable little being was usually summoned into another world, and there gathered to the fathers it had never known in this.",
|
|
46
|
-
"par": [
|
|
47
|
-
{
|
|
48
|
-
"boxes": [
|
|
49
|
-
{
|
|
50
|
-
"r": 1045,
|
|
51
|
-
"b": 811,
|
|
52
|
-
"t": 753,
|
|
53
|
-
"page": PAGE_FIRST_RESULT_ADJUSTED,
|
|
54
|
-
"l": 894
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
"b": 1935,
|
|
58
|
-
"t": 686,
|
|
59
|
-
"page_width": 1790,
|
|
60
|
-
"r": 1704,
|
|
61
|
-
"l": 148,
|
|
62
|
-
"page_height": 2940,
|
|
63
|
-
"page": PAGE_FIRST_RESULT_ADJUSTED
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"text": "That when the Dodger, and his accomplished friend Master Bates, joined in the hue-and-cry which was raised at Oliver's heels, in consequence of their executing an illegal conveyance of Mr. Brownlow's personal property, as has been already described, they were actuated by a very laudable and becoming regard for themselves ; and forasmuch as the freedom of the subject and the liberty of the individual are among the first and proudest boasts of a true-hearted Englishman, so, I need hardly beg the reader to observe, that this action should tend to exalt them in the opinion of all jniblic and patriotic men, in almost as great a degree as this strong proof of their anxiety for their own preservation and safety goes to corroborate and confirm the little code of laws which certain profound and sound-judging philosophers have laid down as the mainsprings of all Nature's deeds and actions : the said philosophers very wisely reducing the good lady's proceedings to matters of maxim and {{{" + TEST_TEXT_FOUND + "}}} : and, by a very neat and pretty compliment to her exalted wisdom and understanding, putting entirely out of sight any considerations of heart, or generous impulse and feeling. For, these are matters totally beneath a female who is acknowledged by universal admission to be far above the numerous little foibles and weaknesses of her sex.",
|
|
69
|
-
"par": [
|
|
70
|
-
{
|
|
71
|
-
"boxes": [
|
|
72
|
-
{
|
|
73
|
-
"r": 593,
|
|
74
|
-
"b": 2567,
|
|
75
|
-
"t": 2507,
|
|
76
|
-
"page": 162,
|
|
77
|
-
"l": 441
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"b": 2631,
|
|
81
|
-
"t": 1439,
|
|
82
|
-
"page_width": 1790,
|
|
83
|
-
"r": 1620,
|
|
84
|
-
"l": 56,
|
|
85
|
-
"page_height": 2940,
|
|
86
|
-
"page": 162
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const SEARCH_MATCHES_LENGTH = MOCKED_RESPONSE_FOUND.matches.length;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ClientFunction } from 'testcafe';
|
|
2
|
-
const getPageUrl = ClientFunction(() => window.location.href);
|
|
3
|
-
|
|
4
|
-
export function runRightToLeftTests (br) {
|
|
5
|
-
test('Right to Left - correct initialization in two-page view', async t => {
|
|
6
|
-
const { nav, BRcontainer} = br;
|
|
7
|
-
await t.click(nav.desktop.mode2Up);
|
|
8
|
-
|
|
9
|
-
//checking right leaf edge has 0 width
|
|
10
|
-
await t.expect(BRcontainer.find('.BRleafEdgeR').getStyleProperty('width')).eql('0px');
|
|
11
|
-
|
|
12
|
-
//checking empty page before the cover is more to the left than the first page
|
|
13
|
-
const rightEmptyPage = BRcontainer.find('.BRpagecontainer.BRemptypage');
|
|
14
|
-
const leftPage = BRcontainer.find('.BRpagecontainer.pagediv0');
|
|
15
|
-
const leftPageLDistance = leftPage.getBoundingClientRectProperty('left');
|
|
16
|
-
const rightPageLDistance = rightEmptyPage.getBoundingClientRectProperty('left');
|
|
17
|
-
await t.expect(rightPageLDistance).gt(await leftPageLDistance);
|
|
18
|
-
|
|
19
|
-
//checks slider is in correct position
|
|
20
|
-
await t.expect(nav.desktop.sliderRange.getStyleProperty('width')).eql('0px');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test('Right to Left - assuring flipping left goes to next page', async t => {
|
|
24
|
-
const { nav } = br;
|
|
25
|
-
await t.click(nav.desktop.mode2Up);
|
|
26
|
-
await t.click(nav.desktop.goLeft);
|
|
27
|
-
await t.expect(getPageUrl()).match(/page\/n2/);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { runBaseTests } from '../helpers/base';
|
|
2
|
-
import BookReader from '../models/BookReader';
|
|
3
|
-
|
|
4
|
-
const localURL = 'https://archive.org/details/';
|
|
5
|
-
const books = [
|
|
6
|
-
'birdbookillustra00reedrich', // publicDomain
|
|
7
|
-
// 'pianoservicingtu00rebl_0', // borrowable,
|
|
8
|
-
// 'adventuresoftoms00twaiiala', // has chapter markers
|
|
9
|
-
// 'gendaitankashu00meijuoft', // Right to Left book
|
|
10
|
-
// 'gov.uspto.patents.application.10074026', // multiple files
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
books.forEach(function(page) {
|
|
14
|
-
const url = `${localURL}${page}`;
|
|
15
|
-
fixture `Archive.org BR Base Tests for: ${page}`.page `${url}`;
|
|
16
|
-
runBaseTests(new BookReader());
|
|
17
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Selector } from 'testcafe';
|
|
2
|
-
import Nav from './Navigation';
|
|
3
|
-
|
|
4
|
-
/** Model defining BookReader base elements */
|
|
5
|
-
export default class BookReader {
|
|
6
|
-
constructor () {
|
|
7
|
-
this.shell = new Selector('.BookReader');
|
|
8
|
-
this.BRcontainer = new Selector('.BRcontainer');
|
|
9
|
-
this.nav = new Nav();
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Selector } from 'testcafe';
|
|
2
|
-
|
|
3
|
-
/** Model defining BookReader's Navigation base elements */
|
|
4
|
-
export default class Navigation {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.topNavShell = new Selector('.BRtoolbar');
|
|
7
|
-
this.bottomNavShell = new Selector('.BRfooter');
|
|
8
|
-
this.mobileMenu = new Selector('.BRmobileMenu');
|
|
9
|
-
this.desktop = new DesktopNav(this.bottomNavShell, this.topNavShell);
|
|
10
|
-
this.mobile = new MobileNav(this.mobileMenu, this.topNavShell);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* DesktopNav Model
|
|
16
|
-
* @class
|
|
17
|
-
* @classdesc defines DesktopNav base elements
|
|
18
|
-
*/
|
|
19
|
-
class DesktopNav {
|
|
20
|
-
constructor(bottomToolbar, topToolbar) {
|
|
21
|
-
// flipping
|
|
22
|
-
this.goLeft = bottomToolbar.find('.BRicon.book_left');
|
|
23
|
-
this.goRight = bottomToolbar.find('.BRicon.book_right');
|
|
24
|
-
this.goNext = bottomToolbar.find('.BRicon.book_flip_next');
|
|
25
|
-
this.goPrev = bottomToolbar.find('.BRicon.book_flip_prev');
|
|
26
|
-
|
|
27
|
-
// mode switching
|
|
28
|
-
this.mode1Up = bottomToolbar.find('.BRicon.onepg');
|
|
29
|
-
this.mode2Up = bottomToolbar.find('.BRicon.twopg');
|
|
30
|
-
this.modeThumb = bottomToolbar.find('.BRicon.thumb');
|
|
31
|
-
this.viewmode = bottomToolbar.find('.BRicon.viewmode');
|
|
32
|
-
|
|
33
|
-
// zoom
|
|
34
|
-
this.zoomIn = bottomToolbar.find('.BRicon.zoom_in');
|
|
35
|
-
this.zoomOut = bottomToolbar.find('.BRicon.zoom_out');
|
|
36
|
-
|
|
37
|
-
// search
|
|
38
|
-
this.searchBox = topToolbar.find('.BRbooksearch.desktop');
|
|
39
|
-
this.searchPin = bottomToolbar.find('.BRsearch');
|
|
40
|
-
this.searchNavigation = bottomToolbar.find('.BRsearch-navigation');
|
|
41
|
-
|
|
42
|
-
// other
|
|
43
|
-
this.fullScreen = bottomToolbar.find('.BRicon.full');
|
|
44
|
-
this.sliderRange = bottomToolbar.find('.ui-slider-range');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
class MobileNav {
|
|
49
|
-
constructor(mobileMenu, topToolbar) {
|
|
50
|
-
this.hamburgerButton = topToolbar.find('.BRmobileHamburger');
|
|
51
|
-
this.menuSearchButton = mobileMenu.find('.BRmobileMenu__search');
|
|
52
|
-
this.searchBox = mobileMenu.find('#BRsearch_tray');
|
|
53
|
-
this.searchResults = mobileMenu.find('[data-id="results"]');
|
|
54
|
-
this.searchResultText = this.searchResults.child(0).find('p');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { runBaseTests } from './helpers/base';
|
|
2
|
-
import { runRightToLeftTests } from './helpers/rightToLeft';
|
|
3
|
-
|
|
4
|
-
import BookReader from './models/BookReader';
|
|
5
|
-
|
|
6
|
-
const { BASE_URL } = process.env;
|
|
7
|
-
const DEMO_PATH = 'demo-internetarchive.html?ocaid=';
|
|
8
|
-
const OCAIDS = [
|
|
9
|
-
'gendaitankashu00meijuoft', // Right to Left book
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
OCAIDS.forEach(ocaid => {
|
|
13
|
-
const url = `${BASE_URL}${DEMO_PATH}${ocaid}`;
|
|
14
|
-
|
|
15
|
-
fixture `Base Tests for right to left book: ${ocaid}`.page `${url}`;
|
|
16
|
-
runBaseTests(new BookReader({ pageProgression: 'rl' }));
|
|
17
|
-
|
|
18
|
-
fixture `Specific Tests for right to left book: ${ocaid}`.page `${url}`;
|
|
19
|
-
runRightToLeftTests(new BookReader());
|
|
20
|
-
});
|