@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,37 +0,0 @@
|
|
|
1
|
-
import { Selector } from 'testcafe';
|
|
2
|
-
import BookReader from './models/BookReader';
|
|
3
|
-
|
|
4
|
-
const { BASE_URL } = process.env;
|
|
5
|
-
|
|
6
|
-
fixture `Viewmode carousel`.page `${BASE_URL}viewmode-cycle.html`;
|
|
7
|
-
|
|
8
|
-
test('Clicking `view mode` cycles through view modes', async t => {
|
|
9
|
-
const { nav } = (new BookReader());
|
|
10
|
-
|
|
11
|
-
// viewmode button only appear on mobile devices
|
|
12
|
-
await t.resizeWindow(400, 800);
|
|
13
|
-
// Flip forward one
|
|
14
|
-
await t.pressKey('right');
|
|
15
|
-
|
|
16
|
-
// 2up to thumb
|
|
17
|
-
await t.click(nav.desktop.viewmode);
|
|
18
|
-
const thumbnailContainer = Selector('.BRmodeThumb');
|
|
19
|
-
await t.expect(thumbnailContainer.visible).ok();
|
|
20
|
-
const thumbImages = thumbnailContainer.find('.BRpageview img');
|
|
21
|
-
await t.expect(thumbImages.count).gt(0);
|
|
22
|
-
|
|
23
|
-
// thumb to 1up
|
|
24
|
-
await t.click(nav.desktop.viewmode);
|
|
25
|
-
const onePageViewContainer = Selector('.BRpageview');
|
|
26
|
-
await t.expect(onePageViewContainer.visible).ok();
|
|
27
|
-
const onePageImages = onePageViewContainer.find('.BRmode1up .BRpagecontainer');
|
|
28
|
-
// we usually pre-fetch the page in question & 1 before/after it
|
|
29
|
-
await t.expect(onePageImages.count).gte(3);
|
|
30
|
-
|
|
31
|
-
// 1up to 2up
|
|
32
|
-
await t.click(nav.desktop.viewmode);
|
|
33
|
-
const twoPageContainer = Selector('.BRtwopageview');
|
|
34
|
-
await t.expect(twoPageContainer.visible).ok();
|
|
35
|
-
const twoPageImages = twoPageContainer.find('img.BRpageimage');
|
|
36
|
-
await t.expect(twoPageImages.count).gte(2);
|
|
37
|
-
});
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
html,
|
|
3
|
-
elementUpdated,
|
|
4
|
-
fixtureCleanup,
|
|
5
|
-
fixtureSync,
|
|
6
|
-
expect,
|
|
7
|
-
} from '@open-wc/testing';
|
|
8
|
-
import sinon from 'sinon';
|
|
9
|
-
|
|
10
|
-
import '../../../src/BookNavigator/BookNavigator.js';
|
|
11
|
-
import BRFullscreenMgr from '../../../src/BookNavigator/br-fullscreen-mgr.js';
|
|
12
|
-
|
|
13
|
-
const container = () => {
|
|
14
|
-
const item = {};
|
|
15
|
-
return html`
|
|
16
|
-
<book-navigator
|
|
17
|
-
.item=${item}
|
|
18
|
-
.baseHost
|
|
19
|
-
>
|
|
20
|
-
<div slot="bookreader">
|
|
21
|
-
<p class="visible-in-reader">now showing</p>
|
|
22
|
-
<div>
|
|
23
|
-
<p class="bunny">foo</p>
|
|
24
|
-
</
|
|
25
|
-
`;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
beforeEach(() => {
|
|
29
|
-
const body = document.querySelector('body');
|
|
30
|
-
const brHook = document.createElement('div');
|
|
31
|
-
brHook.setAttribute('id', 'BookReader');
|
|
32
|
-
body.appendChild(brHook);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
afterEach(() => {
|
|
36
|
-
window.br = null;
|
|
37
|
-
fixtureCleanup();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
describe('<book-navigator>', () => {
|
|
42
|
-
describe('first update', () => {
|
|
43
|
-
it('binds global event listeners', async () => {
|
|
44
|
-
const el = fixtureSync(container());
|
|
45
|
-
const spy = sinon.spy(el, 'bindEventListeners');
|
|
46
|
-
await elementUpdated(el);
|
|
47
|
-
expect(spy.callCount).to.equal(1);
|
|
48
|
-
});
|
|
49
|
-
it('emits a BrBookNav:PostInit event', async () => {
|
|
50
|
-
let initEventFired = false;
|
|
51
|
-
window.addEventListener('BrBookNav:PostInit', (e) => {
|
|
52
|
-
initEventFired = true;
|
|
53
|
-
});
|
|
54
|
-
const el = fixtureSync(container());
|
|
55
|
-
const spy = sinon.spy(el, 'emitPostInit');
|
|
56
|
-
await elementUpdated(el);
|
|
57
|
-
|
|
58
|
-
expect(initEventFired).to.be.true;
|
|
59
|
-
expect(spy.callCount).to.equal(1);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('handles global event: BookReader:PostInit', async () => {
|
|
64
|
-
const setTimeoutSpy = sinon.spy(window, 'setTimeout');
|
|
65
|
-
const brStub = {
|
|
66
|
-
resize: sinon.fake(),
|
|
67
|
-
currentIndex: sinon.fake(),
|
|
68
|
-
jumpToIndex: sinon.fake(),
|
|
69
|
-
el: '#BookReader'
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const el = fixtureSync(container());
|
|
73
|
-
const initializeBookSubmenus = sinon.spy(el, 'initializeBookSubmenus');
|
|
74
|
-
|
|
75
|
-
await elementUpdated(el);
|
|
76
|
-
window.dispatchEvent(new CustomEvent('BookReader:PostInit', {
|
|
77
|
-
detail: { props: brStub }
|
|
78
|
-
}));
|
|
79
|
-
await elementUpdated(el);
|
|
80
|
-
|
|
81
|
-
expect(initializeBookSubmenus.callCount).to.equal(1);
|
|
82
|
-
expect(el.bookreader).to.equal(brStub); // sets bookreader
|
|
83
|
-
expect(el.bookReaderLoaded).to.be.true; // notes bookreader is loaded
|
|
84
|
-
expect(el.bookReaderCannotLoad).to.be.false;
|
|
85
|
-
expect(el.fullscreenMgr).to.an.instanceof(BRFullscreenMgr);
|
|
86
|
-
expect(el.brResizeObserver).to.an.instanceof(window.ResizeObserver);
|
|
87
|
-
expect(setTimeoutSpy.callCount).to.equal(1); // resizes at end
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('resizes bookreader when side menu toggles', async () => {
|
|
91
|
-
const el = fixtureSync(container());
|
|
92
|
-
const brStub = {
|
|
93
|
-
resize: sinon.fake(),
|
|
94
|
-
currentIndex: sinon.fake(),
|
|
95
|
-
jumpToIndex: sinon.fake()
|
|
96
|
-
};
|
|
97
|
-
el.bookreader = brStub;
|
|
98
|
-
await elementUpdated(el);
|
|
99
|
-
|
|
100
|
-
el.sideMenuOpen = true;
|
|
101
|
-
await elementUpdated(el);
|
|
102
|
-
|
|
103
|
-
expect(el.bookreader.resize.callCount).to.equal(1);
|
|
104
|
-
expect(el.bookreader.currentIndex.callCount).to.equal(1);
|
|
105
|
-
expect(el.bookreader.jumpToIndex.callCount).to.equal(1);
|
|
106
|
-
|
|
107
|
-
el.sideMenuOpen = false;
|
|
108
|
-
await elementUpdated(el);
|
|
109
|
-
|
|
110
|
-
expect(el.bookreader.resize.callCount).to.equal(2);
|
|
111
|
-
expect(el.bookreader.currentIndex.callCount).to.equal(2);
|
|
112
|
-
expect(el.bookreader.jumpToIndex.callCount).to.equal(2);
|
|
113
|
-
});
|
|
114
|
-
it('does not resize bookreader if animating', async () => {
|
|
115
|
-
const el = fixtureSync(container());
|
|
116
|
-
const brStub = {
|
|
117
|
-
animating: true, // <-- testing for this
|
|
118
|
-
resize: sinon.fake(),
|
|
119
|
-
currentIndex: sinon.fake(),
|
|
120
|
-
jumpToIndex: sinon.fake()
|
|
121
|
-
};
|
|
122
|
-
el.bookreader = brStub;
|
|
123
|
-
await elementUpdated(el);
|
|
124
|
-
|
|
125
|
-
el.sideMenuOpen = true;
|
|
126
|
-
await elementUpdated(el);
|
|
127
|
-
|
|
128
|
-
expect(el.bookreader.resize.callCount).to.equal(0);
|
|
129
|
-
expect(el.bookreader.currentIndex.callCount).to.equal(0);
|
|
130
|
-
expect(el.bookreader.jumpToIndex.callCount).to.equal(0);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
html,
|
|
3
|
-
fixture,
|
|
4
|
-
expect,
|
|
5
|
-
oneEvent,
|
|
6
|
-
} from '@open-wc/testing';
|
|
7
|
-
import '../../../../src/BookNavigator/bookmarks/bookmark-edit.js';
|
|
8
|
-
|
|
9
|
-
const bookmarkColors = [{
|
|
10
|
-
id: 0,
|
|
11
|
-
className: '',
|
|
12
|
-
}, {
|
|
13
|
-
id: 1,
|
|
14
|
-
className: 'blue',
|
|
15
|
-
}, {
|
|
16
|
-
id: 2,
|
|
17
|
-
className: 'red',
|
|
18
|
-
}, {
|
|
19
|
-
id: 3,
|
|
20
|
-
className: 'green',
|
|
21
|
-
}, {
|
|
22
|
-
id: 4,
|
|
23
|
-
className: 'yellow',
|
|
24
|
-
}];
|
|
25
|
-
|
|
26
|
-
const container = (bookmark = {}) => (
|
|
27
|
-
html`<ia-bookmark-edit .bookmark=${bookmark} .bookmarkColors=${bookmarkColors}></ia-bookmark-edit>`
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const bookmark = {
|
|
31
|
-
id: 2,
|
|
32
|
-
thumbnail: '//placehold.it/37x46/06c/fff',
|
|
33
|
-
page: 9,
|
|
34
|
-
note: 'This is a long comment I left about this bookmark in order to test out the display in the panel on the side of the bookreader.',
|
|
35
|
-
color: 0,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
describe('<ia-bookmark-edit>', () => {
|
|
39
|
-
it('sets default properties', async () => {
|
|
40
|
-
const el = await fixture(container(bookmark));
|
|
41
|
-
|
|
42
|
-
expect(el.bookmark).to.equal(bookmark);
|
|
43
|
-
expect(el.renderHeader).to.be.false;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('renders bookmark thumb and page number', async () => {
|
|
47
|
-
const el = await fixture(container(bookmark));
|
|
48
|
-
|
|
49
|
-
expect(el.shadowRoot.querySelector('img').getAttribute('src')).to.equal(bookmark.thumbnail);
|
|
50
|
-
expect(el.shadowRoot.querySelector('h4').innerText).to.equal(`Page ${bookmark.page}`);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('renders an optional header section', async () => {
|
|
54
|
-
const el = await fixture(container(bookmark));
|
|
55
|
-
el.renderHeader = true;
|
|
56
|
-
|
|
57
|
-
await el.updateComplete;
|
|
58
|
-
|
|
59
|
-
expect(el.shadowRoot.querySelector('header')).to.exist;
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('toggles rendering of the bookmark thumbnail and page number', async () => {
|
|
63
|
-
const el = await fixture(container(bookmark));
|
|
64
|
-
expect(el.shadowRoot.querySelector('img')).to.exist;
|
|
65
|
-
expect(el.shadowRoot.querySelector('h4')).to.exist;
|
|
66
|
-
|
|
67
|
-
el.showBookmark = false;
|
|
68
|
-
await el.updateComplete;
|
|
69
|
-
|
|
70
|
-
expect(el.shadowRoot.querySelector('img')).to.not.exist;
|
|
71
|
-
expect(el.shadowRoot.querySelector('h4')).to.not.exist;
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('emits a custom event when the bookmark color is changed', async () => {
|
|
75
|
-
const el = await fixture(container(bookmark));
|
|
76
|
-
|
|
77
|
-
setTimeout(() => (
|
|
78
|
-
el.shadowRoot.querySelector('li input').dispatchEvent(new Event('change'))
|
|
79
|
-
));
|
|
80
|
-
const response = await oneEvent(el, 'bookmarkColorChanged');
|
|
81
|
-
|
|
82
|
-
expect(response).to.exist;
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('emits a custom event when the edit form is submitted', async () => {
|
|
86
|
-
const el = await fixture(container(bookmark));
|
|
87
|
-
|
|
88
|
-
setTimeout(() => (
|
|
89
|
-
el.shadowRoot.querySelector('form').dispatchEvent(new Event('submit'))
|
|
90
|
-
));
|
|
91
|
-
const response = await oneEvent(el, 'saveBookmark');
|
|
92
|
-
|
|
93
|
-
expect(response).to.exist;
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('emits a custom event when the delete button is clicked', async () => {
|
|
97
|
-
const el = await fixture(container(bookmark));
|
|
98
|
-
|
|
99
|
-
setTimeout(() => (
|
|
100
|
-
el.shadowRoot.querySelector('button').click()
|
|
101
|
-
));
|
|
102
|
-
const response = await oneEvent(el, 'deleteBookmark');
|
|
103
|
-
|
|
104
|
-
expect(response).to.exist;
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('updates bookmark color when a color input changed', async () => {
|
|
108
|
-
const el = await fixture(container(bookmark));
|
|
109
|
-
|
|
110
|
-
setTimeout(() => (
|
|
111
|
-
el.shadowRoot.querySelector('input#color_2').dispatchEvent(new Event('change'))
|
|
112
|
-
));
|
|
113
|
-
await oneEvent(el, 'bookmarkColorChanged');
|
|
114
|
-
|
|
115
|
-
expect(el.bookmark.color).to.equal(2);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('updates bookmark note when the note textarea changed', async () => {
|
|
119
|
-
const el = await fixture(container(bookmark));
|
|
120
|
-
const textarea = el.shadowRoot.querySelector('textarea');
|
|
121
|
-
const updatedNote = 'New note';
|
|
122
|
-
|
|
123
|
-
textarea.value = updatedNote;
|
|
124
|
-
|
|
125
|
-
setTimeout(() => (
|
|
126
|
-
textarea.dispatchEvent(new Event('change'))
|
|
127
|
-
));
|
|
128
|
-
|
|
129
|
-
await oneEvent(textarea, 'change');
|
|
130
|
-
|
|
131
|
-
expect(el.bookmark.note).to.contain(updatedNote);
|
|
132
|
-
});
|
|
133
|
-
});
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
html,
|
|
3
|
-
fixture,
|
|
4
|
-
expect,
|
|
5
|
-
oneEvent,
|
|
6
|
-
} from '@open-wc/testing';
|
|
7
|
-
import '../../../../src/BookNavigator/bookmarks/bookmarks-list.js';
|
|
8
|
-
|
|
9
|
-
const bookmarks = [{
|
|
10
|
-
id: 1,
|
|
11
|
-
thumbnail: '//placehold.it/37x46',
|
|
12
|
-
page: 'xii',
|
|
13
|
-
}, {
|
|
14
|
-
id: 2,
|
|
15
|
-
thumbnail: '//placehold.it/37x46/06c/fff',
|
|
16
|
-
page: 9,
|
|
17
|
-
note: 'This is a long comment I left about this bookmark in order to test out the display in the panel on the side of the bookreader.',
|
|
18
|
-
}, {
|
|
19
|
-
id: 3,
|
|
20
|
-
thumbnail: '//placehold.it/37x46/e5e5e5/06c',
|
|
21
|
-
page: 9,
|
|
22
|
-
note: 'Interesting quote here regarding the division of labor',
|
|
23
|
-
}];
|
|
24
|
-
|
|
25
|
-
const bookmarkColors = [{
|
|
26
|
-
id: 0,
|
|
27
|
-
className: 'blue',
|
|
28
|
-
}, {
|
|
29
|
-
id: 1,
|
|
30
|
-
className: 'red',
|
|
31
|
-
}, {
|
|
32
|
-
id: 2,
|
|
33
|
-
className: 'green',
|
|
34
|
-
}];
|
|
35
|
-
|
|
36
|
-
const container = (bookmarksSet = []) => (
|
|
37
|
-
html`<ia-bookmarks-list .bookmarks=${bookmarksSet} .bookmarkColors=${bookmarkColors}></ia-bookmarks-list>`
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
describe('<ia-bookmarks-list>', () => {
|
|
41
|
-
it('sets default properties', async () => {
|
|
42
|
-
const el = await fixture(container(bookmarks));
|
|
43
|
-
|
|
44
|
-
expect(el.bookmarks).to.equal(bookmarks);
|
|
45
|
-
expect(el.activeBookmarkID).to.be.undefined;
|
|
46
|
-
expect(el.renderHeader).to.be.false;
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('renders bookmarks that contain page numbers', async () => {
|
|
50
|
-
const el = await fixture(container(bookmarks));
|
|
51
|
-
|
|
52
|
-
expect(el.shadowRoot.innerHTML).to.include(`Page ${bookmarks[0].page}`);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('renders bookmarks that contain an optional note', async () => {
|
|
56
|
-
const el = await fixture(container(bookmarks));
|
|
57
|
-
|
|
58
|
-
expect(el.shadowRoot.innerHTML).to.include(bookmarks[1].note);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('emits a custom event when a bookmark is clicked', async () => {
|
|
62
|
-
const el = await fixture(container(bookmarks));
|
|
63
|
-
|
|
64
|
-
setTimeout(() => (
|
|
65
|
-
el.shadowRoot.querySelector('li').click()
|
|
66
|
-
));
|
|
67
|
-
const response = await oneEvent(el, 'bookmarkSelected');
|
|
68
|
-
|
|
69
|
-
expect(response).to.exist;
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('emits a custom event when an edit button is clicked', async () => {
|
|
73
|
-
const el = await fixture(container(bookmarks));
|
|
74
|
-
|
|
75
|
-
setTimeout(() => (
|
|
76
|
-
el.shadowRoot.querySelector('li button').click()
|
|
77
|
-
));
|
|
78
|
-
const response = await oneEvent(el, 'bookmarkEdited');
|
|
79
|
-
|
|
80
|
-
expect(response).to.exist;
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('emits a saveBookmark event', async () => {
|
|
84
|
-
const el = await fixture(container(bookmarks));
|
|
85
|
-
|
|
86
|
-
setTimeout(() => (
|
|
87
|
-
el.emitSaveBookmark(bookmarks[0])
|
|
88
|
-
));
|
|
89
|
-
const response = await oneEvent(el, 'saveBookmark');
|
|
90
|
-
|
|
91
|
-
expect(response).to.exist;
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('emits a deleteBookmark event', async () => {
|
|
95
|
-
const el = await fixture(container(bookmarks));
|
|
96
|
-
|
|
97
|
-
setTimeout(() => (
|
|
98
|
-
el.emitDeleteBookmark(bookmarks[0].id)
|
|
99
|
-
));
|
|
100
|
-
const response = await oneEvent(el, 'deleteBookmark');
|
|
101
|
-
|
|
102
|
-
expect(response).to.exist;
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('emits a bookmarkColorChanged event', async () => {
|
|
106
|
-
const el = await fixture(container(bookmarks));
|
|
107
|
-
|
|
108
|
-
setTimeout(() => (
|
|
109
|
-
el.emitBookmarkColorChanged({ detail: { bookmarkId: 0, colorId: 0 } })
|
|
110
|
-
));
|
|
111
|
-
const response = await oneEvent(el, 'bookmarkColorChanged');
|
|
112
|
-
|
|
113
|
-
expect(response).to.exist;
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('sets editedBookmark when an edit button is clicked', async () => {
|
|
117
|
-
const el = await fixture(container(bookmarks));
|
|
118
|
-
let prevState = el.editedBookmark;
|
|
119
|
-
|
|
120
|
-
el.shadowRoot.querySelector('li button').click();
|
|
121
|
-
await el.updateComplete;
|
|
122
|
-
|
|
123
|
-
expect(el.editedBookmark).not.to.equal(prevState);
|
|
124
|
-
expect(el.editedBookmark.page).to.equal(bookmarks[0].page);
|
|
125
|
-
|
|
126
|
-
// When clicking the same edit button while in edit mode, should toggle
|
|
127
|
-
// edit mode off and remove editedBookmark pointer
|
|
128
|
-
prevState = el.editedBookmark;
|
|
129
|
-
el.shadowRoot.querySelector('li button').click();
|
|
130
|
-
await el.updateComplete;
|
|
131
|
-
|
|
132
|
-
expect(el.editedBookmark).not.to.equal(prevState);
|
|
133
|
-
expect(el.editedBookmark.page).not.to.equal(bookmarks[0].page);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('resets editedBookmark when saveBookmark callback called', async () => {
|
|
137
|
-
const el = await fixture(container(bookmarks));
|
|
138
|
-
|
|
139
|
-
[el.editedBookmark] = bookmarks;
|
|
140
|
-
await el.updateComplete;
|
|
141
|
-
el.saveBookmark({ detail: { bookmark: bookmarks[0] } });
|
|
142
|
-
await el.updateComplete;
|
|
143
|
-
|
|
144
|
-
expect(el.editedBookmark).not.to.equal(bookmarks[0]);
|
|
145
|
-
expect(el.editedBookmark).not.to.have.keys(['page', 'thumbnail', 'id']);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('resets editedBookmark when deleteBookmark callback called', async () => {
|
|
149
|
-
const el = await fixture(container(bookmarks));
|
|
150
|
-
|
|
151
|
-
[el.editedBookmark] = bookmarks;
|
|
152
|
-
await el.updateComplete;
|
|
153
|
-
el.deleteBookmark({ detail: { id: bookmarks[0].id } });
|
|
154
|
-
await el.updateComplete;
|
|
155
|
-
|
|
156
|
-
expect(el.editedBookmark).not.to.equal(bookmarks[0]);
|
|
157
|
-
expect(el.editedBookmark).not.to.have.keys(['page', 'thumbnail', 'id']);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('renders the bookmarks count', async () => {
|
|
161
|
-
const el = await fixture(container([bookmarks[0]]));
|
|
162
|
-
const bookmarksCount = await fixture(el.bookmarksCount);
|
|
163
|
-
|
|
164
|
-
expect(bookmarksCount.innerHTML).to.include('(1)');
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('does not render the bookmarks count when no bookmarks present', async () => {
|
|
168
|
-
const el = await fixture(container());
|
|
169
|
-
el.renderHeader = true;
|
|
170
|
-
|
|
171
|
-
await el.updateComplete;
|
|
172
|
-
|
|
173
|
-
expect(el.shadowRoot.querySelector('header small')).not.to.exist;
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('renders an optional header section', async () => {
|
|
177
|
-
const el = await fixture(container(bookmarks));
|
|
178
|
-
el.renderHeader = true;
|
|
179
|
-
|
|
180
|
-
await el.updateComplete;
|
|
181
|
-
|
|
182
|
-
expect(el.shadowRoot.querySelector('header')).to.exist;
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// skipped:
|
|
186
|
-
// Uncaught TypeError: Cannot read property 'click' of null
|
|
187
|
-
xit('emits a custom event when the add bookmark button is clicked', async () => {
|
|
188
|
-
const el = await fixture(container(bookmarks));
|
|
189
|
-
|
|
190
|
-
setTimeout(() => (
|
|
191
|
-
el.shadowRoot.querySelector('.add-bookmark').click()
|
|
192
|
-
));
|
|
193
|
-
const response = await oneEvent(el, 'addBookmark');
|
|
194
|
-
|
|
195
|
-
expect(response).to.exist;
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// skipped:
|
|
199
|
-
// AssertionError: expected null to exist
|
|
200
|
-
xit('renders an optional add bookmark button', async () => {
|
|
201
|
-
const el = await fixture(container(bookmarks));
|
|
202
|
-
|
|
203
|
-
expect(el.shadowRoot.querySelector('.add-bookmark')).to.exist;
|
|
204
|
-
|
|
205
|
-
el.renderAddBookmarkButton = false;
|
|
206
|
-
await el.updateComplete;
|
|
207
|
-
|
|
208
|
-
expect(el.shadowRoot.querySelector('.add-bookmark')).not.to.exist;
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
// skipped:
|
|
212
|
-
// TypeError: Cannot read property 'getAttribute' of null
|
|
213
|
-
xit('can toggle disable behavior of add bookmark button', async () => {
|
|
214
|
-
const el = await fixture(container(bookmarks));
|
|
215
|
-
expect(el.shadowRoot.querySelector('.add-bookmark').getAttribute('disabled')).to.be.null;
|
|
216
|
-
|
|
217
|
-
el.disableAddBookmarkButton = true;
|
|
218
|
-
await el.updateComplete;
|
|
219
|
-
|
|
220
|
-
expect(el.shadowRoot.querySelector('.add-bookmark').getAttribute('disabled')).to.equal('disabled');
|
|
221
|
-
});
|
|
222
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { expect } from '@open-wc/testing';
|
|
2
|
-
import sinon from 'sinon';
|
|
3
|
-
import searchProvider from '../../../../src/BookNavigator/search/search-provider';
|
|
4
|
-
|
|
5
|
-
afterEach(() => {
|
|
6
|
-
sinon.restore();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
describe('Search Provider', () => {
|
|
10
|
-
describe('constructor', () => {
|
|
11
|
-
const onSearchChangeCB = sinon.fake();
|
|
12
|
-
const br = sinon.fake();
|
|
13
|
-
const provider = new searchProvider(onSearchChangeCB, br);
|
|
14
|
-
|
|
15
|
-
expect(provider.bookreader).to.equal(br);
|
|
16
|
-
expect(provider.onSearchChange).to.equal(onSearchChangeCB);
|
|
17
|
-
expect(provider.id).to.equal('search');
|
|
18
|
-
expect(provider.icon).to.exist;
|
|
19
|
-
expect(provider.label).to.equal('Search inside');
|
|
20
|
-
expect(provider.menuDetails).to.exist;
|
|
21
|
-
expect(provider.component).to.exist;
|
|
22
|
-
});
|
|
23
|
-
});
|