@internetarchive/bookreader 5.0.0-94 → 5.0.0-96
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/BookReader.js +1 -1
- 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/README.md +0 -2
- package/package.json +6 -1
- package/.eslintrc.cjs +0 -51
- 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 -102
- package/.github/workflows/npm-publish.yml +0 -33
- package/.testcaferc.cjs +0 -10
- package/BookReaderDemo/BookReaderDemo.css +0 -40
- package/BookReaderDemo/BookReaderJSAdvanced.js +0 -112
- package/BookReaderDemo/BookReaderJSSimple.js +0 -56
- package/BookReaderDemo/IADemoBr.js +0 -149
- 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/demo-advanced.html +0 -33
- package/BookReaderDemo/demo-embed-iframe-src.html +0 -85
- package/BookReaderDemo/demo-embed.html +0 -26
- package/BookReaderDemo/demo-fullscreen-mobile.html +0 -34
- package/BookReaderDemo/demo-fullscreen.html +0 -31
- package/BookReaderDemo/demo-iiif.html +0 -121
- package/BookReaderDemo/demo-internetarchive.html +0 -271
- package/BookReaderDemo/demo-multiple.html +0 -44
- package/BookReaderDemo/demo-preview-pages.html +0 -1093
- package/BookReaderDemo/demo-simple.html +0 -35
- package/BookReaderDemo/demo-vendor-fullscreen.html +0 -34
- package/BookReaderDemo/ia-multiple-volumes-manifest.js +0 -169
- package/BookReaderDemo/immersion-1up.html +0 -64
- package/BookReaderDemo/immersion-mode.html +0 -33
- package/BookReaderDemo/toggle_controls.html +0 -54
- package/BookReaderDemo/view_mode.html +0 -40
- package/BookReaderDemo/viewmode-cycle.html +0 -40
- package/CHANGELOG.md +0 -1080
- package/CONTRIBUTING.md +0 -7
- package/babel.config.cjs +0 -20
- package/codecov.yml +0 -23
- package/index.html +0 -34
- package/netlify.toml +0 -9
- package/renovate.json +0 -52
- package/screenshot.png +0 -0
- package/scripts/postversion.js +0 -11
- package/scripts/preversion.js +0 -15
- package/scripts/version.js +0 -27
- package/tests/e2e/README.md +0 -112
- package/tests/e2e/autoplay.test.js +0 -16
- package/tests/e2e/base.test.js +0 -27
- package/tests/e2e/helpers/base.js +0 -263
- package/tests/e2e/helpers/debug.js +0 -13
- package/tests/e2e/helpers/mockSearch.js +0 -90
- package/tests/e2e/helpers/params.js +0 -17
- package/tests/e2e/helpers/rightToLeft.js +0 -23
- package/tests/e2e/helpers/search.js +0 -73
- package/tests/e2e/models/BookReader.js +0 -11
- package/tests/e2e/models/Navigation.js +0 -39
- package/tests/e2e/rightToLeft.test.js +0 -19
- package/tests/e2e/viewmode.test.js +0 -44
- package/tests/jest/BookNavigator/book-navigator.test.js +0 -653
- package/tests/jest/BookNavigator/bookmarks/bookmark-button.test.js +0 -43
- package/tests/jest/BookNavigator/bookmarks/bookmark-edit.test.js +0 -132
- package/tests/jest/BookNavigator/bookmarks/bookmarks-list.test.js +0 -221
- package/tests/jest/BookNavigator/bookmarks/ia-bookmarks.test.js +0 -45
- package/tests/jest/BookNavigator/downloads/downloads-provider.test.js +0 -67
- package/tests/jest/BookNavigator/downloads/downloads.test.js +0 -53
- package/tests/jest/BookNavigator/search/search-provider.test.js +0 -179
- package/tests/jest/BookNavigator/search/search-results.test.js +0 -289
- package/tests/jest/BookNavigator/sharing/sharing-provider.test.js +0 -49
- package/tests/jest/BookNavigator/viewable-files/viewable-files-provider.test.js +0 -80
- package/tests/jest/BookNavigator/visual-adjustments.test.js +0 -200
- package/tests/jest/BookReader/BookModel.test.js +0 -372
- package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +0 -263
- package/tests/jest/BookReader/ImageCache.test.js +0 -150
- package/tests/jest/BookReader/Mode1UpLit.test.js +0 -73
- package/tests/jest/BookReader/Mode2Up.test.js +0 -98
- package/tests/jest/BookReader/Mode2UpLit.test.js +0 -190
- package/tests/jest/BookReader/ModeCoordinateSpace.test.js +0 -16
- package/tests/jest/BookReader/ModeSmoothZoom.test.js +0 -218
- package/tests/jest/BookReader/ModeThumb.test.js +0 -71
- package/tests/jest/BookReader/Navbar/Navbar.test.js +0 -182
- package/tests/jest/BookReader/PageContainer.test.js +0 -249
- package/tests/jest/BookReader/ReduceSet.test.js +0 -38
- package/tests/jest/BookReader/Toolbar/Toolbar.test.js +0 -26
- package/tests/jest/BookReader/utils/HTMLDimensionsCacher.test.js +0 -59
- package/tests/jest/BookReader/utils/ScrollClassAdder.test.js +0 -49
- package/tests/jest/BookReader/utils/SelectionObserver.test.js +0 -57
- package/tests/jest/BookReader/utils/classes.test.js +0 -88
- package/tests/jest/BookReader/utils.test.js +0 -250
- package/tests/jest/BookReader.keyboard.test.js +0 -190
- package/tests/jest/BookReader.options.test.js +0 -47
- package/tests/jest/BookReader.test.js +0 -316
- package/tests/jest/plugins/plugin.archive_analytics.test.js +0 -20
- package/tests/jest/plugins/plugin.autoplay.test.js +0 -35
- package/tests/jest/plugins/plugin.chapters.test.js +0 -193
- package/tests/jest/plugins/plugin.iframe.test.js +0 -42
- package/tests/jest/plugins/plugin.resume.test.js +0 -85
- package/tests/jest/plugins/plugin.text_selection.test.js +0 -447
- package/tests/jest/plugins/plugin.vendor-fullscreen.test.js +0 -65
- package/tests/jest/plugins/search/plugin.search.test.js +0 -120
- package/tests/jest/plugins/search/plugin.search.view.test.js +0 -131
- package/tests/jest/plugins/search/utils.js +0 -25
- package/tests/jest/plugins/search/utils.test.js +0 -29
- package/tests/jest/plugins/tts/AbstractTTSEngine.test.js +0 -173
- package/tests/jest/plugins/tts/FestivalTTSEngine.test.js +0 -59
- package/tests/jest/plugins/tts/PageChunk.test.js +0 -57
- package/tests/jest/plugins/tts/PageChunkIterator.test.js +0 -179
- package/tests/jest/plugins/tts/WebTTSEngine.test.js +0 -178
- package/tests/jest/plugins/tts/utils.test.js +0 -74
- package/tests/jest/plugins/url/UrlPlugin.test.js +0 -198
- package/tests/jest/plugins/url/plugin.url.test.js +0 -168
- package/tests/jest/setup.js +0 -3
- package/tests/jest/util/browserSniffing.test.js +0 -62
- package/tests/jest/util/docCookies.test.js +0 -24
- package/tests/jest/util/strings.test.js +0 -63
- package/tests/jest/utils.js +0 -83
- package/webpack.config.js +0 -97
@@ -1,90 +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 = /\/fulltext\/inside\.php/;
|
6
|
-
|
7
|
-
/** Mock response for a matching search term. */
|
8
|
-
export function mockResponseFound(req, res) {
|
9
|
-
res.headers['Access-Control-Allow-Origin'] = '*';
|
10
|
-
res.headers['Content-Type'] = 'application/json';
|
11
|
-
res.setBody(JSON.stringify(MOCKED_RESPONSE_FOUND));
|
12
|
-
}
|
13
|
-
|
14
|
-
/** Mock response for a matching search term. */
|
15
|
-
export function mockResponseNotFound(req, res) {
|
16
|
-
res.headers['Access-Control-Allow-Origin'] = '*';
|
17
|
-
res.headers['Content-Type'] = 'application/json';
|
18
|
-
res.setBody(JSON.stringify(MOCKED_RESPONSE_NOT_FOUND));
|
19
|
-
}
|
20
|
-
|
21
|
-
const PAGE_FIRST_RESULT_ADJUSTED = PAGE_FIRST_RESULT + 12;
|
22
|
-
//mocked objects inside an unsuccessful search and of a random successful search returned by search requests
|
23
|
-
const MOCKED_RESPONSE_NOT_FOUND = {
|
24
|
-
"ia": "theworksofplato01platiala",
|
25
|
-
"q": TEST_TEXT_NOT_FOUND,
|
26
|
-
"indexed": true,
|
27
|
-
"page_count": 1,
|
28
|
-
"body_length": 666,
|
29
|
-
"leaf0_missing": true,
|
30
|
-
"matches": [],
|
31
|
-
};
|
32
|
-
|
33
|
-
const MOCKED_RESPONSE_FOUND = {
|
34
|
-
"ia": "This request has been mocked",
|
35
|
-
"q": TEST_TEXT_FOUND,
|
36
|
-
"indexed": true,
|
37
|
-
"page_count": 644,
|
38
|
-
"body_length": 666,
|
39
|
-
"leaf0_missing": false,
|
40
|
-
"matches": [
|
41
|
-
{
|
42
|
-
"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.",
|
43
|
-
"par": [
|
44
|
-
{
|
45
|
-
"boxes": [
|
46
|
-
{
|
47
|
-
"r": 1045,
|
48
|
-
"b": 811,
|
49
|
-
"t": 753,
|
50
|
-
"page": PAGE_FIRST_RESULT_ADJUSTED,
|
51
|
-
"l": 894,
|
52
|
-
},
|
53
|
-
],
|
54
|
-
"b": 1935,
|
55
|
-
"t": 686,
|
56
|
-
"page_width": 1790,
|
57
|
-
"r": 1704,
|
58
|
-
"l": 148,
|
59
|
-
"page_height": 2940,
|
60
|
-
"page": PAGE_FIRST_RESULT_ADJUSTED,
|
61
|
-
},
|
62
|
-
],
|
63
|
-
},
|
64
|
-
{
|
65
|
-
"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.",
|
66
|
-
"par": [
|
67
|
-
{
|
68
|
-
"boxes": [
|
69
|
-
{
|
70
|
-
"r": 593,
|
71
|
-
"b": 2567,
|
72
|
-
"t": 2507,
|
73
|
-
"page": 162,
|
74
|
-
"l": 441,
|
75
|
-
},
|
76
|
-
],
|
77
|
-
"b": 2631,
|
78
|
-
"t": 1439,
|
79
|
-
"page_width": 1790,
|
80
|
-
"r": 1620,
|
81
|
-
"l": 56,
|
82
|
-
"page_height": 2940,
|
83
|
-
"page": 162,
|
84
|
-
},
|
85
|
-
],
|
86
|
-
},
|
87
|
-
],
|
88
|
-
};
|
89
|
-
|
90
|
-
export const SEARCH_MATCHES_LENGTH = MOCKED_RESPONSE_FOUND.matches.length;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
class TestParams {
|
3
|
-
baseUrl = process.env.BASE_URL?.replace(/\/+$/, '') ?? 'http://127.0.0.1:8000'
|
4
|
-
ocaids = process.env.OCAIDS?.split(',') ?? null;
|
5
|
-
/** Whether the url we're testing is a prod (or near prod) IA url, or a demos url */
|
6
|
-
isIA = new URL(this.baseUrl).hostname.endsWith('archive.org');
|
7
|
-
|
8
|
-
/** @param {string} ocaid */
|
9
|
-
getArchiveUrl(ocaid) {
|
10
|
-
return this.isIA ? `${this.baseUrl}/details/${ocaid}`
|
11
|
-
// Otherwise it's a demo page
|
12
|
-
: `${this.baseUrl}/BookReaderDemo/demo-internetarchive.html?ocaid=${ocaid}`;
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
const params = new TestParams();
|
17
|
-
export default params;
|
@@ -1,23 +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.mode2Up);
|
8
|
-
|
9
|
-
//checking right leaf edge is not in tree
|
10
|
-
await t.expect(BRcontainer.find('.br-mode-2up__leafs--left').count).eql(1);
|
11
|
-
await t.expect(BRcontainer.find('.br-mode-2up__leafs--right').count).eql(0);
|
12
|
-
|
13
|
-
//checks slider is in correct position
|
14
|
-
await t.expect(nav.sliderRange.getStyleProperty('width')).eql('0px');
|
15
|
-
});
|
16
|
-
|
17
|
-
test('Right to Left - assuring flipping left goes to next page', async t => {
|
18
|
-
const { nav } = br;
|
19
|
-
await t.click(nav.mode2Up);
|
20
|
-
await t.click(nav.goLeft);
|
21
|
-
await t.expect(getPageUrl()).match(/page\/n1/);
|
22
|
-
});
|
23
|
-
}
|
@@ -1,73 +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 runSearchTests(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)('Search - successful search', async t => {
|
19
|
-
const nav = br.nav;
|
20
|
-
|
21
|
-
//assuring that the search bar is enabled
|
22
|
-
await t.expect(nav.searchIcon.visible).ok();
|
23
|
-
await t.click(nav.searchIcon);
|
24
|
-
|
25
|
-
//testing search for a word found in the book
|
26
|
-
await t.selectText(nav.searchBox).pressKey('delete');
|
27
|
-
// FIXME: Why is it only typing every other letter?!?!
|
28
|
-
await t.typeText(nav.searchBox, TEST_TEXT_FOUND.split('').join('_'));
|
29
|
-
await t.pressKey('enter');
|
30
|
-
|
31
|
-
await t.expect(nav.searchPin.exists).ok();
|
32
|
-
await t.expect(nav.searchPin.child('.BRquery').child('main').exists).ok();
|
33
|
-
await t.expect(nav.searchPin.child('.BRquery').child('main').innerText).contains(TEST_TEXT_FOUND);
|
34
|
-
await t.expect(nav.searchNavigation.exists).ok();
|
35
|
-
await t.expect(nav.searchNavigation.find('[data-id="resultsCount"]').exists).ok();
|
36
|
-
await t.expect(nav.searchNavigation.find('[data-id="resultsCount"]').innerText).contains(SEARCH_MATCHES_LENGTH);
|
37
|
-
|
38
|
-
//checking url
|
39
|
-
const getPageUrl = ClientFunction(() => window.location.href.toString());
|
40
|
-
await t.expect(getPageUrl()).contains(TEST_TEXT_FOUND);
|
41
|
-
|
42
|
-
//checks clicking on first search pin opens correct page
|
43
|
-
await t.click(nav.searchPin);
|
44
|
-
await t.expect(getPageUrl()).contains(PAGE_FIRST_RESULT);
|
45
|
-
|
46
|
-
//checks highlight on result page is visible
|
47
|
-
const highlight = br.shell.find(".searchHiliteLayer rect");
|
48
|
-
await t.expect(highlight.visible).ok();
|
49
|
-
|
50
|
-
});
|
51
|
-
|
52
|
-
|
53
|
-
test
|
54
|
-
.requestHooks(mockNotFound)('Search - unsuccessful search', async t => {
|
55
|
-
const nav = br.nav;
|
56
|
-
|
57
|
-
//assuring that the search bar is enabled
|
58
|
-
await t.expect(nav.searchIcon.visible).ok();
|
59
|
-
await t.click(nav.searchIcon);
|
60
|
-
|
61
|
-
//testing search for a word not found in the book
|
62
|
-
await t.selectText(nav.searchBox).pressKey('delete');
|
63
|
-
// FIXME: Why is it only typing every other letter?!?!
|
64
|
-
await t.typeText(nav.searchBox, TEST_TEXT_NOT_FOUND.split('').join('_'));
|
65
|
-
await t.pressKey('enter');
|
66
|
-
await t.expect(nav.searchPin.child('.BRquery').child('main').withText(TEST_TEXT_NOT_FOUND).exists).notOk();
|
67
|
-
|
68
|
-
const getPageUrl = ClientFunction(() => window.location.href.toString());
|
69
|
-
await t.expect(getPageUrl()).contains(TEST_TEXT_NOT_FOUND);
|
70
|
-
});
|
71
|
-
|
72
|
-
|
73
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { Selector } from 'testcafe';
|
2
|
-
import Nav from './Navigation.js';
|
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,39 +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.itemNav = Selector('ia-bookreader').shadowRoot().find('iaux-item-navigator').shadowRoot();
|
9
|
-
|
10
|
-
// flipping
|
11
|
-
this.goLeft = this.bottomNavShell.find('.BRicon.book_left');
|
12
|
-
this.goRight = this.bottomNavShell.find('.BRicon.book_right');
|
13
|
-
this.goNext = this.bottomNavShell.find('.BRicon.book_flip_next');
|
14
|
-
this.goPrev = this.bottomNavShell.find('.BRicon.book_flip_prev');
|
15
|
-
|
16
|
-
// mode switching
|
17
|
-
this.mode1Up = this.bottomNavShell.find('.BRicon.onepg');
|
18
|
-
this.mode2Up = this.bottomNavShell.find('.BRicon.twopg');
|
19
|
-
this.modeThumb = this.bottomNavShell.find('.BRicon.thumb');
|
20
|
-
this.viewmode = this.bottomNavShell.find('.BRicon.viewmode');
|
21
|
-
|
22
|
-
// zoom
|
23
|
-
this.zoomIn = this.bottomNavShell.find('.BRicon.zoom_in');
|
24
|
-
this.zoomOut = this.bottomNavShell.find('.BRicon.zoom_out');
|
25
|
-
|
26
|
-
// search
|
27
|
-
this.searchIcon = this.itemNav.find('button.shortcut.search');
|
28
|
-
this.searchBox = this.itemNav
|
29
|
-
.find('ia-menu-slider').shadowRoot()
|
30
|
-
.find('ia-book-search-results').shadowRoot()
|
31
|
-
.find('input[name=query]');
|
32
|
-
this.searchPin = this.bottomNavShell.find('.BRsearch');
|
33
|
-
this.searchNavigation = this.bottomNavShell.find('.BRsearch-navigation');
|
34
|
-
|
35
|
-
// other
|
36
|
-
this.fullScreen = this.bottomNavShell.find('.BRicon.full');
|
37
|
-
this.sliderRange = this.bottomNavShell.find('.ui-slider-range');
|
38
|
-
}
|
39
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { runBaseTests } from './helpers/base.js';
|
2
|
-
import { runRightToLeftTests } from './helpers/rightToLeft.js';
|
3
|
-
import params from './helpers/params.js';
|
4
|
-
|
5
|
-
import BookReader from './models/BookReader.js';
|
6
|
-
|
7
|
-
const ocaids = params.ocaids || [
|
8
|
-
'gendaitankashu00meijuoft', // Right to Left book
|
9
|
-
];
|
10
|
-
|
11
|
-
ocaids.forEach(ocaid => {
|
12
|
-
const url = `${params.getArchiveUrl(ocaid)}`;
|
13
|
-
|
14
|
-
fixture `Base Tests for right to left book: ${ocaid}`.page `${url}`;
|
15
|
-
runBaseTests(new BookReader({ pageProgression: 'rl' }));
|
16
|
-
|
17
|
-
fixture `Specific Tests for right to left book: ${ocaid}`.page `${url}`;
|
18
|
-
runRightToLeftTests(new BookReader());
|
19
|
-
});
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import { Selector } from 'testcafe';
|
2
|
-
import BookReader from './models/BookReader.js';
|
3
|
-
import params from './helpers/params.js';
|
4
|
-
|
5
|
-
const ocaids = params.ocaids || ['goody'];
|
6
|
-
|
7
|
-
ocaids.forEach(ocaid => {
|
8
|
-
const url = params.getArchiveUrl(ocaid);
|
9
|
-
|
10
|
-
fixture `Viewmode carousel`.page `${url}`;
|
11
|
-
|
12
|
-
test('Clicking `view mode` cycles through view modes', async t => {
|
13
|
-
const { nav } = (new BookReader());
|
14
|
-
|
15
|
-
// viewmode button only appear on mobile devices
|
16
|
-
await t.resizeWindow(400, 800);
|
17
|
-
// Flip forward one
|
18
|
-
await t.pressKey('right');
|
19
|
-
await t.pressKey('right');
|
20
|
-
await t.pressKey('right');
|
21
|
-
|
22
|
-
// 1up to 2up
|
23
|
-
await t.click(nav.viewmode);
|
24
|
-
const twoPageContainer = Selector('.BRmode2up');
|
25
|
-
await t.expect(twoPageContainer.visible).ok();
|
26
|
-
const twoPageImages = twoPageContainer.find('img.BRpageimage');
|
27
|
-
await t.expect(twoPageImages.count).gte(2);
|
28
|
-
|
29
|
-
// 2up to thumb
|
30
|
-
await t.click(nav.viewmode);
|
31
|
-
const thumbnailContainer = Selector('.BRmodeThumb');
|
32
|
-
await t.expect(thumbnailContainer.visible).ok();
|
33
|
-
const thumbImages = thumbnailContainer.find('.BRpageview img');
|
34
|
-
await t.expect(thumbImages.count).gt(0);
|
35
|
-
|
36
|
-
// thumb to 1up
|
37
|
-
await t.click(nav.viewmode);
|
38
|
-
const onePageViewContainer = Selector('br-mode-1up');
|
39
|
-
await t.expect(onePageViewContainer.visible).ok();
|
40
|
-
const onePageImages = onePageViewContainer.find('.BRmode1up .BRpagecontainer');
|
41
|
-
// we usually pre-fetch the page in question & 1 before/after it
|
42
|
-
await t.expect(onePageImages.count).gte(2);
|
43
|
-
});
|
44
|
-
});
|