-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `bypass` rule ensures each page has at least one mechanism for a user to bypass navigation and jump straight to the content. This makes no real sense for EPUBs, where an HTML document may well contain the continuity of previous content. Closes #40
- Loading branch information
Showing
7 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const tmp = require('tmp'); | ||
|
||
const runAce = require('../runAceJS'); | ||
|
||
tmp.setGracefulCleanup(); | ||
|
||
let outdir; | ||
let tmpdir; | ||
let reportPath; | ||
|
||
beforeEach(() => { | ||
outdir = tmp.dirSync({ prefix: 'ace_out_', unsafeCleanup: true }); | ||
tmpdir = tmp.dirSync({ prefix: 'ace_tmp_', unsafeCleanup: true }); | ||
reportPath = path.join(outdir.name, 'ace.json'); | ||
}); | ||
|
||
afterEach(() => { | ||
outdir.removeCallback(); | ||
tmpdir.removeCallback(); | ||
}); | ||
|
||
|
||
function ace(epub, options = {}) { | ||
return runAce(path.join(__dirname, epub), Object.assign({ | ||
outdir: outdir.name, | ||
tmp: tmpdir.name, | ||
}, options)) | ||
.then(() => { | ||
expect(fs.existsSync(reportPath)).toBeTruthy(); | ||
return JSON.parse(fs.readFileSync(reportPath, 'utf8')); | ||
}) | ||
.catch(err => console.log(err)); | ||
} | ||
|
||
test('`bypass` rule is disabled', async () => { | ||
const report = await ace('../data/axerule-bypass'); | ||
expect(report['earl:result']['earl:outcome']).toEqual('pass'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en"> | ||
<head> | ||
<title>Minimal EPUB</title> | ||
</head> | ||
<body> | ||
<a href="http://example.com">link</a> | ||
<p>Call me Ishmael.</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en"> | ||
<head> | ||
<title>Minimal Nav</title> | ||
</head> | ||
<body> | ||
<nav epub:type="toc"> | ||
<ol> | ||
<li><a href="content_001.xhtml">content 001</a></li> | ||
</ol> | ||
</nav> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="uid"> | ||
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"> | ||
<dc:title id="title">Minimal EPUB 3.0</dc:title> | ||
<dc:language>en</dc:language> | ||
<dc:identifier id="uid">NOID</dc:identifier> | ||
<meta property="dcterms:modified">2017-01-01T00:00:01Z</meta> | ||
</metadata> | ||
<manifest> | ||
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/> | ||
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml"/> | ||
</manifest> | ||
<spine> | ||
<itemref idref="content_001" /> | ||
</spine> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> | ||
<rootfiles> | ||
<rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/> | ||
</rootfiles> | ||
</container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
application/epub+zip |