@internetarchive/bookreader 5.0.0-18
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/.eslintrc.js +58 -0
- package/.gitattributes +2 -0
- package/.github/ISSUE_TEMPLATE/bug.md +32 -0
- package/.github/ISSUE_TEMPLATE/feature-request.md +30 -0
- package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +15 -0
- package/.github/dependabot.yml +8 -0
- package/.github/workflows/node.js.yml +37 -0
- package/.github/workflows/npm-publish.yml +47 -0
- package/.testcaferc.json +5 -0
- package/BookReader/BookReader.css +2983 -0
- package/BookReader/BookReader.js +3 -0
- package/BookReader/BookReader.js.LICENSE.txt +117 -0
- package/BookReader/BookReader.js.map +1 -0
- package/BookReader/bookreader-component-bundle.js +1436 -0
- package/BookReader/bookreader-component-bundle.js.LICENSE.txt +27 -0
- package/BookReader/bookreader-component-bundle.js.map +1 -0
- package/BookReader/icons/1up.svg +1 -0
- package/BookReader/icons/2up.svg +1 -0
- package/BookReader/icons/advance.svg +3 -0
- package/BookReader/icons/chevron-right.svg +1 -0
- package/BookReader/icons/close-circle-dark.svg +1 -0
- package/BookReader/icons/close-circle.svg +1 -0
- package/BookReader/icons/fullscreen.svg +1 -0
- package/BookReader/icons/fullscreen_exit.svg +1 -0
- package/BookReader/icons/hamburger.svg +1 -0
- package/BookReader/icons/left-arrow.svg +1 -0
- package/BookReader/icons/magnify-minus.svg +1 -0
- package/BookReader/icons/magnify-plus.svg +1 -0
- package/BookReader/icons/magnify.svg +1 -0
- package/BookReader/icons/pause.svg +1 -0
- package/BookReader/icons/play.svg +1 -0
- package/BookReader/icons/playback-speed.svg +1 -0
- package/BookReader/icons/read-aloud.svg +1 -0
- package/BookReader/icons/review.svg +3 -0
- package/BookReader/icons/thumbnails.svg +1 -0
- package/BookReader/icons/volume-full.svg +1 -0
- package/BookReader/images/BRicons.png +0 -0
- package/BookReader/images/BRicons.svg +5 -0
- package/BookReader/images/BRicons_ia.png +0 -0
- package/BookReader/images/back_pages.png +0 -0
- package/BookReader/images/book_bottom_icon.png +0 -0
- package/BookReader/images/book_down_icon.png +0 -0
- package/BookReader/images/book_left_icon.png +0 -0
- package/BookReader/images/book_leftmost_icon.png +0 -0
- package/BookReader/images/book_right_icon.png +0 -0
- package/BookReader/images/book_rightmost_icon.png +0 -0
- package/BookReader/images/book_top_icon.png +0 -0
- package/BookReader/images/book_up_icon.png +0 -0
- package/BookReader/images/books_graphic.svg +1 -0
- package/BookReader/images/booksplit.png +0 -0
- package/BookReader/images/control_pause_icon.png +0 -0
- package/BookReader/images/control_play_icon.png +0 -0
- package/BookReader/images/embed_icon.png +0 -0
- package/BookReader/images/icon-home-ia.png +0 -0
- package/BookReader/images/icon_OL-logo-xs.png +0 -0
- package/BookReader/images/icon_alert-xs.png +0 -0
- package/BookReader/images/icon_book.svg +1 -0
- package/BookReader/images/icon_bookmark.svg +1 -0
- package/BookReader/images/icon_close-pop.png +0 -0
- package/BookReader/images/icon_download.png +0 -0
- package/BookReader/images/icon_gear.svg +1 -0
- package/BookReader/images/icon_hamburger.svg +1 -0
- package/BookReader/images/icon_home.png +0 -0
- package/BookReader/images/icon_home.svg +1 -0
- package/BookReader/images/icon_home_ia.png +0 -0
- package/BookReader/images/icon_indicator.png +0 -0
- package/BookReader/images/icon_info.svg +1 -0
- package/BookReader/images/icon_one_page.svg +1 -0
- package/BookReader/images/icon_pause.svg +1 -0
- package/BookReader/images/icon_play.svg +1 -0
- package/BookReader/images/icon_playback-rate.svg +1 -0
- package/BookReader/images/icon_return.png +0 -0
- package/BookReader/images/icon_search_button.svg +1 -0
- package/BookReader/images/icon_share.svg +1 -0
- package/BookReader/images/icon_skip-ahead.svg +1 -0
- package/BookReader/images/icon_skip-back.svg +2 -0
- package/BookReader/images/icon_speaker.svg +1 -0
- package/BookReader/images/icon_speaker_open.svg +1 -0
- package/BookReader/images/icon_thumbnails.svg +1 -0
- package/BookReader/images/icon_toc.svg +1 -0
- package/BookReader/images/icon_two_pages.svg +1 -0
- package/BookReader/images/icon_zoomer.png +0 -0
- package/BookReader/images/loading.gif +0 -0
- package/BookReader/images/logo_icon.png +0 -0
- package/BookReader/images/marker_chap-off.png +0 -0
- package/BookReader/images/marker_chap-off.svg +1 -0
- package/BookReader/images/marker_chap-off_ia.png +0 -0
- package/BookReader/images/marker_chap-on.png +0 -0
- package/BookReader/images/marker_chap-on.svg +1 -0
- package/BookReader/images/marker_srch-on.svg +1 -0
- package/BookReader/images/marker_srchchap-off.png +0 -0
- package/BookReader/images/marker_srchchap-on.png +0 -0
- package/BookReader/images/nav_control-dn.png +0 -0
- package/BookReader/images/nav_control-dn_ia.png +0 -0
- package/BookReader/images/nav_control-up.png +0 -0
- package/BookReader/images/nav_control-up_ia.png +0 -0
- package/BookReader/images/nav_control.png +0 -0
- package/BookReader/images/one_page_mode_icon.png +0 -0
- package/BookReader/images/paper-badge.png +0 -0
- package/BookReader/images/print_icon.png +0 -0
- package/BookReader/images/progressbar.gif +0 -0
- package/BookReader/images/right_edges.png +0 -0
- package/BookReader/images/slider.png +0 -0
- package/BookReader/images/slider_ia.png +0 -0
- package/BookReader/images/thumbnail_mode_icon.png +0 -0
- package/BookReader/images/transparent.png +0 -0
- package/BookReader/images/two_page_mode_icon.png +0 -0
- package/BookReader/images/zoom_in_icon.png +0 -0
- package/BookReader/images/zoom_out_icon.png +0 -0
- package/BookReader/jquery-1.10.1.js +2 -0
- package/BookReader/jquery-1.10.1.js.LICENSE.txt +24 -0
- package/BookReader/plugins/plugin.archive_analytics.js +2 -0
- package/BookReader/plugins/plugin.archive_analytics.js.map +1 -0
- package/BookReader/plugins/plugin.autoplay.js +2 -0
- package/BookReader/plugins/plugin.autoplay.js.map +1 -0
- package/BookReader/plugins/plugin.chapters.js +2 -0
- package/BookReader/plugins/plugin.chapters.js.map +1 -0
- package/BookReader/plugins/plugin.iframe.js +2 -0
- package/BookReader/plugins/plugin.iframe.js.map +1 -0
- package/BookReader/plugins/plugin.mobile_nav.js +2 -0
- package/BookReader/plugins/plugin.mobile_nav.js.map +1 -0
- package/BookReader/plugins/plugin.resume.js +2 -0
- package/BookReader/plugins/plugin.resume.js.map +1 -0
- package/BookReader/plugins/plugin.search.js +2 -0
- package/BookReader/plugins/plugin.search.js.map +1 -0
- package/BookReader/plugins/plugin.text_selection.js +2 -0
- package/BookReader/plugins/plugin.text_selection.js.map +1 -0
- package/BookReader/plugins/plugin.tts.js +3 -0
- package/BookReader/plugins/plugin.tts.js.LICENSE.txt +27 -0
- package/BookReader/plugins/plugin.tts.js.map +1 -0
- package/BookReader/plugins/plugin.url.js +2 -0
- package/BookReader/plugins/plugin.url.js.map +1 -0
- package/BookReader/plugins/plugin.vendor-fullscreen.js +2 -0
- package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -0
- package/BookReaderDemo/BookReaderDemo.css +41 -0
- package/BookReaderDemo/BookReaderJSAdvanced.js +115 -0
- package/BookReaderDemo/BookReaderJSAutoplay.js +56 -0
- package/BookReaderDemo/BookReaderJSSimple.js +55 -0
- package/BookReaderDemo/IIIFBookReader.js +207 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-cool-grad.svg +1 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-flat.svg +1 -0
- 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 +1 -0
- package/BookReaderDemo/assets/v5/Bookreader-logo-warm.svg +1 -0
- 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 +7178 -0
- package/BookReaderDemo/demo-advanced.html +32 -0
- package/BookReaderDemo/demo-autoplay.html +38 -0
- package/BookReaderDemo/demo-embed-iframe-src.html +84 -0
- package/BookReaderDemo/demo-embed.html +26 -0
- package/BookReaderDemo/demo-fullscreen-mobile.html +36 -0
- package/BookReaderDemo/demo-fullscreen.html +33 -0
- package/BookReaderDemo/demo-iiif.html +34 -0
- package/BookReaderDemo/demo-iiif.js +26 -0
- package/BookReaderDemo/demo-internetarchive.html +74 -0
- package/BookReaderDemo/demo-multiple.html +43 -0
- package/BookReaderDemo/demo-preview-pages.html +1092 -0
- package/BookReaderDemo/demo-simple.html +34 -0
- package/BookReaderDemo/demo-vendor-fullscreen.html +36 -0
- package/BookReaderDemo/immersion-1up.html +64 -0
- package/BookReaderDemo/immersion-mode.html +35 -0
- package/BookReaderDemo/toggle_controls.html +53 -0
- package/BookReaderDemo/view_mode.html +39 -0
- package/BookReaderDemo/viewmode-cycle.html +41 -0
- package/CHANGELOG.md +540 -0
- package/CONTRIBUTING.md +7 -0
- package/LICENSE +661 -0
- package/README.md +205 -0
- package/babel.config.js +18 -0
- package/codecov.yml +17 -0
- package/index.html +31 -0
- package/jsconfig.json +14 -0
- package/karma.conf.js +23 -0
- package/package.json +129 -0
- package/screenshot.png +0 -0
- package/scripts/postversion.js +10 -0
- package/scripts/preversion.js +14 -0
- package/scripts/version.js +26 -0
- package/src/BookNavigator/BookModel.js +14 -0
- package/src/BookNavigator/BookNavigator.js +468 -0
- package/src/BookNavigator/assets/book-loader.js +27 -0
- package/src/BookNavigator/assets/bookmark-colors.js +15 -0
- package/src/BookNavigator/assets/button-base.js +61 -0
- package/src/BookNavigator/assets/icon_checkmark.js +6 -0
- package/src/BookNavigator/assets/icon_close.js +3 -0
- package/src/BookNavigator/assets/icon_sort_asc.js +5 -0
- package/src/BookNavigator/assets/icon_sort_desc.js +5 -0
- package/src/BookNavigator/assets/icon_sort_neutral.js +5 -0
- package/src/BookNavigator/assets/icon_volumes.js +11 -0
- package/src/BookNavigator/bookmarks/bookmark-button.js +64 -0
- package/src/BookNavigator/bookmarks/bookmark-edit.js +215 -0
- package/src/BookNavigator/bookmarks/bookmarks-list.js +285 -0
- package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +28 -0
- package/src/BookNavigator/bookmarks/bookmarks-provider.js +53 -0
- package/src/BookNavigator/bookmarks/ia-bookmarks.js +500 -0
- package/src/BookNavigator/br-fullscreen-mgr.js +83 -0
- package/src/BookNavigator/delete-modal-actions.js +49 -0
- package/src/BookNavigator/downloads/downloads-provider.js +76 -0
- package/src/BookNavigator/downloads/downloads.js +138 -0
- package/src/BookNavigator/search/a-search-result.js +55 -0
- package/src/BookNavigator/search/search-provider.js +180 -0
- package/src/BookNavigator/search/search-results.js +360 -0
- package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +93 -0
- package/src/BookNavigator/visual-adjustments/visual-adjustments.js +280 -0
- package/src/BookNavigator/volumes/volumes-provider.js +83 -0
- package/src/BookNavigator/volumes/volumes.js +178 -0
- package/src/BookReader/BookModel.js +518 -0
- package/src/BookReader/DebugConsole.js +54 -0
- package/src/BookReader/ImageCache.js +116 -0
- package/src/BookReader/Mode1Up.js +90 -0
- package/src/BookReader/Mode1UpLit.js +434 -0
- package/src/BookReader/Mode2Up.js +1372 -0
- package/src/BookReader/ModeSmoothZoom.js +177 -0
- package/src/BookReader/ModeThumb.js +336 -0
- package/src/BookReader/Navbar/Navbar.js +339 -0
- package/src/BookReader/PageContainer.js +120 -0
- package/src/BookReader/ReduceSet.js +26 -0
- package/src/BookReader/Toolbar/Toolbar.js +384 -0
- package/src/BookReader/events.js +20 -0
- package/src/BookReader/options.js +320 -0
- package/src/BookReader/utils/HTMLDimensionsCacher.js +44 -0
- package/src/BookReader/utils/classes.js +36 -0
- package/src/BookReader/utils.js +240 -0
- package/src/BookReader.js +2546 -0
- package/src/BookReaderComponent/BookReaderComponent.js +112 -0
- package/src/ItemNavigator/ItemNavigator.js +376 -0
- package/src/ItemNavigator/providers/sharing.js +33 -0
- package/src/assets/icons/1up.svg +12 -0
- package/src/assets/icons/2up.svg +15 -0
- package/src/assets/icons/advance.svg +26 -0
- package/src/assets/icons/chevron-right.svg +1 -0
- package/src/assets/icons/close-circle-dark.svg +1 -0
- package/src/assets/icons/close-circle.svg +1 -0
- package/src/assets/icons/fullscreen.svg +17 -0
- package/src/assets/icons/fullscreen_exit.svg +17 -0
- package/src/assets/icons/hamburger.svg +15 -0
- package/src/assets/icons/left-arrow.svg +12 -0
- package/src/assets/icons/magnify-minus.svg +16 -0
- package/src/assets/icons/magnify-plus.svg +17 -0
- package/src/assets/icons/magnify.svg +15 -0
- package/src/assets/icons/pause.svg +23 -0
- package/src/assets/icons/play.svg +22 -0
- package/src/assets/icons/playback-speed.svg +34 -0
- package/src/assets/icons/read-aloud.svg +22 -0
- package/src/assets/icons/review.svg +22 -0
- package/src/assets/icons/thumbnails.svg +17 -0
- package/src/assets/icons/volume-full.svg +22 -0
- package/src/assets/images/BRicons.png +0 -0
- package/src/assets/images/BRicons.svg +94 -0
- package/src/assets/images/BRicons_ia.png +0 -0
- package/src/assets/images/back_pages.png +0 -0
- package/src/assets/images/book_bottom_icon.png +0 -0
- package/src/assets/images/book_down_icon.png +0 -0
- package/src/assets/images/book_left_icon.png +0 -0
- package/src/assets/images/book_leftmost_icon.png +0 -0
- package/src/assets/images/book_right_icon.png +0 -0
- package/src/assets/images/book_rightmost_icon.png +0 -0
- package/src/assets/images/book_top_icon.png +0 -0
- package/src/assets/images/book_up_icon.png +0 -0
- package/src/assets/images/books_graphic.svg +177 -0
- package/src/assets/images/booksplit.png +0 -0
- package/src/assets/images/control_pause_icon.png +0 -0
- package/src/assets/images/control_play_icon.png +0 -0
- package/src/assets/images/embed_icon.png +0 -0
- package/src/assets/images/icon-home-ia.png +0 -0
- package/src/assets/images/icon_OL-logo-xs.png +0 -0
- package/src/assets/images/icon_alert-xs.png +0 -0
- package/src/assets/images/icon_book.svg +12 -0
- package/src/assets/images/icon_bookmark.svg +12 -0
- package/src/assets/images/icon_close-pop.png +0 -0
- package/src/assets/images/icon_download.png +0 -0
- package/src/assets/images/icon_gear.svg +14 -0
- package/src/assets/images/icon_hamburger.svg +20 -0
- package/src/assets/images/icon_home.png +0 -0
- package/src/assets/images/icon_home.svg +21 -0
- package/src/assets/images/icon_home_ia.png +0 -0
- package/src/assets/images/icon_indicator.png +0 -0
- package/src/assets/images/icon_info.svg +11 -0
- package/src/assets/images/icon_one_page.svg +8 -0
- package/src/assets/images/icon_pause.svg +1 -0
- package/src/assets/images/icon_play.svg +1 -0
- package/src/assets/images/icon_playback-rate.svg +15 -0
- package/src/assets/images/icon_return.png +0 -0
- package/src/assets/images/icon_search_button.svg +8 -0
- package/src/assets/images/icon_share.svg +9 -0
- package/src/assets/images/icon_skip-ahead.svg +6 -0
- package/src/assets/images/icon_skip-back.svg +13 -0
- package/src/assets/images/icon_speaker.svg +18 -0
- package/src/assets/images/icon_speaker_open.svg +10 -0
- package/src/assets/images/icon_thumbnails.svg +12 -0
- package/src/assets/images/icon_toc.svg +5 -0
- package/src/assets/images/icon_two_pages.svg +9 -0
- package/src/assets/images/icon_zoomer.png +0 -0
- package/src/assets/images/loading.gif +0 -0
- package/src/assets/images/logo_icon.png +0 -0
- package/src/assets/images/marker_chap-off.png +0 -0
- package/src/assets/images/marker_chap-off.svg +11 -0
- package/src/assets/images/marker_chap-off_ia.png +0 -0
- package/src/assets/images/marker_chap-on.png +0 -0
- package/src/assets/images/marker_chap-on.svg +11 -0
- package/src/assets/images/marker_srch-on.svg +11 -0
- package/src/assets/images/marker_srchchap-off.png +0 -0
- package/src/assets/images/marker_srchchap-on.png +0 -0
- package/src/assets/images/nav_control-dn.png +0 -0
- package/src/assets/images/nav_control-dn_ia.png +0 -0
- package/src/assets/images/nav_control-up.png +0 -0
- package/src/assets/images/nav_control-up_ia.png +0 -0
- package/src/assets/images/nav_control.png +0 -0
- package/src/assets/images/one_page_mode_icon.png +0 -0
- package/src/assets/images/paper-badge.png +0 -0
- package/src/assets/images/print_icon.png +0 -0
- package/src/assets/images/progressbar.gif +0 -0
- package/src/assets/images/right_edges.png +0 -0
- package/src/assets/images/slider.png +0 -0
- package/src/assets/images/slider_ia.png +0 -0
- package/src/assets/images/thumbnail_mode_icon.png +0 -0
- package/src/assets/images/transparent.png +0 -0
- package/src/assets/images/two_page_mode_icon.png +0 -0
- package/src/assets/images/zoom_in_icon.png +0 -0
- package/src/assets/images/zoom_out_icon.png +0 -0
- package/src/css/BookReader.scss +89 -0
- package/src/css/_BRBookmarks.scss +29 -0
- package/src/css/_BRComponent.scss +13 -0
- package/src/css/_BRfloat.scss +197 -0
- package/src/css/_BRicon.scss +48 -0
- package/src/css/_BRmain.scss +251 -0
- package/src/css/_BRnav.scss +382 -0
- package/src/css/_BRpages.scss +139 -0
- package/src/css/_BRsearch.scss +226 -0
- package/src/css/_BRtoolbar.scss +84 -0
- package/src/css/_BRvendor.scss +5 -0
- package/src/css/_MobileNav.scss +194 -0
- package/src/css/_TextSelection.scss +32 -0
- package/src/css/_colorbox.scss +52 -0
- package/src/css/_controls.scss +244 -0
- package/src/css/_icons.scss +121 -0
- package/src/dragscrollable-br.js +261 -0
- package/src/jquery-wrapper.js +4 -0
- package/src/plugins/plugin.archive_analytics.js +86 -0
- package/src/plugins/plugin.autoplay.js +129 -0
- package/src/plugins/plugin.chapters.js +251 -0
- package/src/plugins/plugin.iframe.js +48 -0
- package/src/plugins/plugin.mobile_nav.js +287 -0
- package/src/plugins/plugin.resume.js +68 -0
- package/src/plugins/plugin.text_selection.js +291 -0
- package/src/plugins/plugin.url.js +198 -0
- package/src/plugins/plugin.vendor-fullscreen.js +247 -0
- package/src/plugins/search/plugin.search.js +439 -0
- package/src/plugins/search/view.js +440 -0
- package/src/plugins/tts/AbstractTTSEngine.js +242 -0
- package/src/plugins/tts/FestivalTTSEngine.js +169 -0
- package/src/plugins/tts/PageChunk.js +107 -0
- package/src/plugins/tts/PageChunkIterator.js +163 -0
- package/src/plugins/tts/WebTTSEngine.js +352 -0
- package/src/plugins/tts/plugin.tts.js +335 -0
- package/src/plugins/tts/tooltip_dict.js +15 -0
- package/src/plugins/tts/utils.js +91 -0
- package/src/util/browserSniffing.js +30 -0
- package/src/util/debouncer.js +26 -0
- package/src/util/docCookies.js +67 -0
- package/src/util/strings.js +34 -0
- package/tests/BookReader/BookModel.test.js +312 -0
- package/tests/BookReader/BookReaderPublicFunctions.test.js +164 -0
- package/tests/BookReader/DebugConsole.test.js +25 -0
- package/tests/BookReader/ImageCache.test.js +150 -0
- package/tests/BookReader/Mode1UpLit.test.js +87 -0
- package/tests/BookReader/Mode2Up.test.js +245 -0
- package/tests/BookReader/ModeSmoothZoom.test.js +149 -0
- package/tests/BookReader/Navbar/Navbar.test.js +169 -0
- package/tests/BookReader/PageContainer.test.js +187 -0
- package/tests/BookReader/ReduceSet.test.js +38 -0
- package/tests/BookReader/Toolbar/Toolbar.test.js +26 -0
- package/tests/BookReader/utils/HTMLDimensionsCacher.test.js +59 -0
- package/tests/BookReader/utils/classes.test.js +88 -0
- package/tests/BookReader/utils.test.js +136 -0
- package/tests/BookReader.options.test.js +39 -0
- package/tests/BookReader.test.js +301 -0
- package/tests/e2e/README.md +75 -0
- package/tests/e2e/autoplay.test.js +13 -0
- package/tests/e2e/base.test.js +35 -0
- package/tests/e2e/helpers/base.js +263 -0
- package/tests/e2e/helpers/debug.js +13 -0
- package/tests/e2e/helpers/desktopSearch.js +72 -0
- package/tests/e2e/helpers/mobileSearch.js +85 -0
- package/tests/e2e/helpers/mockSearch.js +93 -0
- package/tests/e2e/helpers/rightToLeft.js +29 -0
- package/tests/e2e/ia-production/ia-prod-base.js +17 -0
- package/tests/e2e/models/BookReader.js +11 -0
- package/tests/e2e/models/Navigation.js +56 -0
- package/tests/e2e/rightToLeft.test.js +20 -0
- package/tests/e2e/viewmode.test.js +37 -0
- package/tests/karma/BookNavigator/book-navigator.test.js +180 -0
- package/tests/karma/BookNavigator/bookmarks/bookmark-edit.test.js +133 -0
- package/tests/karma/BookNavigator/bookmarks/bookmarks-list.test.js +222 -0
- package/tests/karma/BookNavigator/downloads/downloads-provider.test.js +64 -0
- package/tests/karma/BookNavigator/downloads/downloads.test.js +54 -0
- package/tests/karma/BookNavigator/search/search-provider.test.js +23 -0
- package/tests/karma/BookNavigator/search/search-results.test.js +240 -0
- package/tests/karma/BookNavigator/sharing/sharing-provider.test.js +40 -0
- package/tests/karma/BookNavigator/visual-adjustments.test.js +201 -0
- package/tests/karma/BookNavigator/volumes/volumes-provider.test.js +160 -0
- package/tests/karma/BookNavigator/volumes/volumes.test.js +98 -0
- package/tests/plugins/plugin.archive_analytics.test.js +23 -0
- package/tests/plugins/plugin.autoplay.test.js +52 -0
- package/tests/plugins/plugin.chapters.test.js +130 -0
- package/tests/plugins/plugin.iframe.test.js +42 -0
- package/tests/plugins/plugin.mobile_nav.test.js +66 -0
- package/tests/plugins/plugin.resume.test.js +98 -0
- package/tests/plugins/plugin.text_selection.test.js +193 -0
- package/tests/plugins/plugin.url.test.js +129 -0
- package/tests/plugins/plugin.vendor-fullscreen.test.js +65 -0
- package/tests/plugins/search/plugin.search.test.js +173 -0
- package/tests/plugins/search/plugin.search.view.test.js +106 -0
- package/tests/plugins/tts/AbstractTTSEngine.test.js +153 -0
- package/tests/plugins/tts/FestivalTTSEngine.test.js +59 -0
- package/tests/plugins/tts/PageChunk.test.js +57 -0
- package/tests/plugins/tts/PageChunkIterator.test.js +179 -0
- package/tests/plugins/tts/WebTTSEngine.test.js +126 -0
- package/tests/plugins/tts/utils.test.js +133 -0
- package/tests/util/browserSniffing.test.js +56 -0
- package/tests/util/docCookies.test.js +15 -0
- package/tests/util/strings.test.js +63 -0
- package/tests/utils.js +80 -0
- package/webpack.config.js +85 -0
@@ -0,0 +1,133 @@
|
|
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
|
+
});
|
@@ -0,0 +1,222 @@
|
|
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
|
+
});
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { expect } from '@open-wc/testing';
|
2
|
+
import sinon from 'sinon';
|
3
|
+
import DownloadsProvider from '../../../../src/BookNavigator/downloads/downloads-provider';
|
4
|
+
|
5
|
+
const downloadableTypes = [
|
6
|
+
["PDF", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.pdf"],
|
7
|
+
["ePub", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.epub"],
|
8
|
+
["Plain Text", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala_djvu.txt"],
|
9
|
+
["DAISY", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala_daisy.zip"],
|
10
|
+
["Kindle", "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.mobi"]
|
11
|
+
];
|
12
|
+
|
13
|
+
const downloads = [
|
14
|
+
{
|
15
|
+
type: "PDF",
|
16
|
+
url: "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.pdf",
|
17
|
+
note: "PDF files contain high quality images of pages."
|
18
|
+
},
|
19
|
+
{
|
20
|
+
type: "ePub",
|
21
|
+
url: "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.epub",
|
22
|
+
note: "ePub files are smaller in size, but may contain errors."
|
23
|
+
}
|
24
|
+
];
|
25
|
+
|
26
|
+
afterEach(() => {
|
27
|
+
sinon.restore();
|
28
|
+
});
|
29
|
+
|
30
|
+
describe('Downloads Provider', () => {
|
31
|
+
it('constructor - initial setup', () => {
|
32
|
+
const isBookProtected = false;
|
33
|
+
const provider = new DownloadsProvider(isBookProtected);
|
34
|
+
|
35
|
+
expect(provider.id).to.equal('downloads');
|
36
|
+
expect(provider.icon).to.exist;
|
37
|
+
expect(provider.label).to.equal('Downloadable files');
|
38
|
+
expect(provider.menuDetails).to.exist;
|
39
|
+
expect(provider.component).to.exist;
|
40
|
+
|
41
|
+
provider.update(downloadableTypes);
|
42
|
+
|
43
|
+
expect(provider.isBookProtected).to.equal(false);
|
44
|
+
|
45
|
+
expect(provider.downloads[0].type).to.equals("PDF");
|
46
|
+
expect(provider.downloads[1].type).to.equals("ePub");
|
47
|
+
|
48
|
+
expect(provider.menuDetails).to.equal(`(${downloads.length} formats)`);
|
49
|
+
});
|
50
|
+
|
51
|
+
it('render view if book is protected', () => {
|
52
|
+
const isBookProtected = true;
|
53
|
+
const provider = new DownloadsProvider(isBookProtected);
|
54
|
+
|
55
|
+
expect(provider.isBookProtected).to.equal(true);
|
56
|
+
|
57
|
+
provider.update(downloadableTypes);
|
58
|
+
|
59
|
+
expect(provider.downloads[0].type).to.equals("Encrypted Adobe PDF");
|
60
|
+
expect(provider.downloads[1].type).to.equals("Encrypted Adobe ePub");
|
61
|
+
|
62
|
+
expect(provider.downloads.length).to.equals(downloads.length);
|
63
|
+
});
|
64
|
+
});
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import {
|
2
|
+
html,
|
3
|
+
fixture,
|
4
|
+
expect,
|
5
|
+
fixtureCleanup,
|
6
|
+
} from '@open-wc/testing';
|
7
|
+
import sinon from 'sinon';
|
8
|
+
import '../../../../src/BookNavigator/downloads/downloads';
|
9
|
+
|
10
|
+
|
11
|
+
const downloads = [
|
12
|
+
{
|
13
|
+
type: "PDF",
|
14
|
+
url: "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.pdf",
|
15
|
+
note: "PDF files contain high quality images of pages."
|
16
|
+
},
|
17
|
+
{
|
18
|
+
type: "ePub",
|
19
|
+
url: "//archive.org/download/theworksofplato01platiala/theworksofplato01platiala.epub",
|
20
|
+
note: "ePub files are smaller in size, but may contain errors."
|
21
|
+
}
|
22
|
+
];
|
23
|
+
|
24
|
+
|
25
|
+
const container = (downloads) => (
|
26
|
+
html`
|
27
|
+
<ia-book-downloads .downloads=${downloads}></ia-book-downloads>
|
28
|
+
`
|
29
|
+
);
|
30
|
+
|
31
|
+
beforeEach(() => {
|
32
|
+
const body = document.querySelector('body');
|
33
|
+
const brHook = document.createElement('div');
|
34
|
+
brHook.setAttribute('id', 'BookReader');
|
35
|
+
body.appendChild(brHook);
|
36
|
+
});
|
37
|
+
|
38
|
+
afterEach(() => {
|
39
|
+
sinon.restore();
|
40
|
+
fixtureCleanup();
|
41
|
+
});
|
42
|
+
|
43
|
+
describe('<ia-book-downloads>', () => {
|
44
|
+
it('sets default properties', async () => {
|
45
|
+
const el = await fixture(container(downloads));
|
46
|
+
await el.updateComplete;
|
47
|
+
|
48
|
+
expect(el.downloads.length).to.equal(2);
|
49
|
+
expect(el.shadowRoot.querySelector("ul").childElementCount).to.equal(2);
|
50
|
+
expect(el.isBookProtected).to.equal(false);
|
51
|
+
|
52
|
+
expect(el.shadowRoot.querySelector("ul li a").innerHTML).to.include("Get PDF");
|
53
|
+
});
|
54
|
+
});
|
@@ -0,0 +1,23 @@
|
|
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
|
+
});
|