-
Notifications
You must be signed in to change notification settings - Fork 396
/
package-document.feature
773 lines (589 loc) · 30.6 KB
/
package-document.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
Feature: EPUB 3 — Package document
Checks conformance to the "Package document" section of the EPUB 3.3 specification:
https://www.w3.org/TR/epub-33/#sec-package-doc
Background:
Given test files located at '/epub3/05-package-document/files/'
And EPUBCheck with default settings
## 5. Package Document
Scenario: Verify that the Package Document can have any extension
When checking EPUB 'package-file-extension-unusual-valid'
Then no errors or warnings are reported
## 5.3 Shared attributes
### 5.3.1 The dir attribute
@spec @xref:attrdef-dir
Scenario: the 'dir' attribute value can be 'auto'
When checking file 'attr-dir-auto-valid.opf'
Then no errors or warnings are reported
### 5.3.2 The href attribute
@spec @xref:attrdef-href
Scenario: 'link' target must not reference a manifest ID
When checking file 'link-to-publication-resource-error.opf'
Then error OPF-067 is reported
And no other errors or warnings are reported
### 5.3.3 The id attribute
Scenario: 'id' attributes can have leading or trailing space
When checking file 'attr-id-with-spaces-valid.opf'
Then no errors or warnings are reported
@spec @xref:attrdef-id
Scenario: 'id' attributes must be unique
When checking file 'attr-id-duplicate-error.opf'
Then error RSC-005 is reported 2 times (once for each ID)
And no other errors or warnings are reported
@spec @xref:attrdef-id
Scenario: 'id' attributes must be unique after whitespace normalization
When checking file 'attr-id-duplicate-with-spaces-error.opf'
Then error RSC-005 is reported 2 times (once for each ID)
And no other errors or warnings are reported
### 5.3.6 The refines attribute
@spec @xref:attrdef-refines
Scenario: 'refines' attribute MUST be a relative URL
When checking file 'metadata-refines-not-relative-error.opf'
Then error RSC-005 is reported
And the message contains "@refines must be a relative URL"
And no other errors or warnings are reported
Scenario: 'refines' attribute should use a fragment ID if refering to a Publication Resource
When checking file 'metadata-refines-not-a-fragment-warning.opf'
Then warning RSC-017 is reported
And the message contains "using a fragment identifier pointing to its manifest item"
And no other errors or warnings are reported
@spec @xref:attrdef-refines
Scenario: 'refines' attribute, when using fragment ID, must target an existing ID
When checking file 'metadata-refines-unknown-id-error.opf'
Then error RSC-005 is reported
And the message contains "@refines missing target id"
And no other errors or warnings are reported
@spec @xref:attrdef-refines
Scenario: 'refines' references cycles are not allowed
When checking file 'metadata-refines-cycle-error.opf'
Then error OPF-065 is reported
And no other errors or warnings are reported
### 5.3.7 The xml:lang attribute
@spec @xref:attrdef-xml-lang
Scenario: the 'xml:lang' attribute can be empty
When checking file 'attr-lang-empty-valid.opf'
Then no other errors or warnings are reported
@spec @xref:attrdef-xml-lang
Scenario: the 'xml:lang' language tag must not have leading/trailing whitespace
When checking file 'attr-lang-whitespace-error.opf'
Then error OPF-092 is reported
And no other errors or warnings are reported
@spec @xref:attrdef-xml-lang
Scenario: the 'xml:lang' language tag must be well-formed
When checking file 'attr-lang-not-well-formed-error.opf'
Then error OPF-092 is reported
And no other errors or warnings are reported
@spec @xref:attrdef-xml-lang
Scenario: Verify that three-character language codes are allowed (issue 615)
When checking EPUB 'attr-lang-three-char-code-valid.opf'
Then no errors or warnings are reported
## 5.4 The package element
@spec @xref:sec-package-elem
Scenario: the 'package' 'unique-identifier' attribute must be a known ID
When checking file 'package-unique-identifier-unknown-error.opf'
Then error RSC-005 is reported
And the message contains "does not resolve to a dc:identifier element"
And no other errors or warnings are reported
@spec @xref:sec-package-elem
Scenario: the 'package' 'unique-identifier' attribute must point to a 'dc:identifier' element
When checking file 'package-unique-identifier-not-targeting-identifier-error.opf'
Then error RSC-005 is reported
And the message contains "does not resolve to a dc:identifier element"
And no other errors or warnings are reported
@spec @xref:sec-package-elem
Scenario: the 'package' element must have a 'metadata' child element
When checking file 'package-no-metadata-element-error.opf'
Then error RSC-005 is reported (missing metadata element)
And the message contains 'missing required element "metadata"'
And error RSC-005 is reported (side effect: missing unique-identifier target)
And no other errors or warnings are reported
@spec @xref:sec-package-elem
Scenario: the 'package' element's 'metadata' child must be before the 'manifest' child
When checking file 'package-manifest-before-metadata-error.opf'
Then error RSC-005 is reported
And the message contains 'element "manifest" not allowed yet'
And error RSC-005 is reported
And the message contains 'element "metadata" not allowed here'
And no other errors or warnings are reported
## 5.5 Metadata section
### 5.5.1 The metadata element
### 5.5.2 Metadata values
@spec @xref:sec-metadata-values
Scenario: the unique identifier must not be empty
When checking EPUB 'package-unique-identifier-attribute-missing-error.opf'
# FIXME OPF-048 could be removed, as it is already reported as RSC-005
Then the following errors are reported
| RSC-005 | missing required attribute |
| OPF-048 | missing its required unique-identifier attribute |
And no other errors or warnings are reported
@spec @xref:sec-metadata-values
Scenario: 'dc:identifier' must not be empty
When checking file 'metadata-identifier-empty-error.opf'
Then error RSC-005 is reported
And the message contains "must be a string with length at least 1"
And no other errors or warnings are reported
@spec @xref:sec-metadata-values
Scenario: 'dc:language' must not be empty
When checking file 'metadata-language-empty-error.opf'
Then error RSC-005 is reported
And the message contains "must be a string with length at least 1"
And no other errors or warnings are reported
@spec @xref:sec-metadata-values
Scenario: 'dc:title' must not be empty
When checking file 'metadata-title-empty-error.opf'
Then error RSC-005 is reported
And the message contains "must be a string with length at least 1"
And no other errors or warnings are reported
@spec @xref:sec-metadata-values
Scenario: a metadata's value must be defined
When checking file 'metadata-meta-value-empty-error.opf'
Then error RSC-005 is reported
And the message contains "must be a string with length at least 1"
And no other errors or warnings are reported
### 5.5.3 Dublin Core required elements
#### 5.5.3.1 The dc:identifier element
Scenario: 'dc:identifier' starting with "urn:uuid:" should be a valid UUID
When checking file 'metadata-identifier-uuid-invalid-warning.opf'
Then warning OPF-085 is reported
And no other errors or warnings are reported
#### 5.5.3.2 The dc:title element
@spec @xref:sec-opf-dctitle
Scenario: 'dc:title' must be specified
When checking file 'metadata-title-missing-error.opf'
Then error RSC-005 is reported
And the message contains 'missing required element "dc:title"'
And no other errors or warnings are reported
#### 5.5.3.3 The dc:language element
@spec @xref:sec-opf-dclanguage
Scenario: 'dc:language' must be well-formed
When checking file 'metadata-language-not-well-formed-error.opf'
Then error OPF-092 is reported
And no other errors or warnings are reported
### 5.5.4 Dublin Core optional elements
#### 5.5.4.1 General definition
Scenario: 'dc:source' valid values are allowed
When checking file 'metadata-source-valid.opf'
Then no errors or warnings are reported
#### 5.5.4.4 The dc:date element
@spec @xref:sec-opf-dcdate
Scenario: Multiple 'dc:date' elements specified
When checking file 'metadata-date-multiple-error.opf'
Then error RSC-005 is reported
And the message contains 'element "dc:date" not allowed here'
And no errors or warnings are reported
Scenario: 'dc:date' can be specified as an ISO 8601:2004 value
When checking file 'metadata-date-single-year-valid.opf'
Then no errors or warnings are reported
Scenario: 'dc:date' can be specified as a single year
When checking file 'metadata-date-single-year-valid.opf'
Then no errors or warnings are reported
Scenario: 'dc:date' value can have leading/trailng whitespace
When checking file 'metadata-date-with-whitespace-valid.opf'
Then no errors or warnings are reported
Scenario: 'dc:date' with an invalid ISO 8601:2004 syntax is reported
When checking file 'metadata-date-iso-syntax-error-warning.opf'
Then warning OPF-053 is reported
And the message contains "does not follow recommended syntax"
And no errors or warnings are reported
Scenario: 'dc:date' with an unknown format is reported
When checking file 'metadata-date-unknown-format-warning.opf'
Then warning OPF-053 is reported
And the message contains "does not follow recommended syntax"
And no errors or warnings are reported
#### 5.5.4.6 The dc:type element
Scenario: 'dc:type' valid values are allowed
When checking file 'metadata-type-valid.opf'
Then no errors or warnings are reported
### 5.5.5 The meta element
@spec @xref:sec-meta-elem
Scenario: a metadata's property name must be defined
When checking file 'metadata-meta-property-empty-error.opf'
Then error RSC-005 is reported 2 times
And the message contains 'value of attribute "property" is invalid'
And no other errors or warnings are reported
@spec @xref:sec-meta-elem
Scenario: a metadata's property name must not be a list of values
When checking file 'metadata-meta-property-list-error.opf'
Then error RSC-005 is reported (value is not an NMTOKEN)
Then error OPF-025 is reported
And the message contains "only one value must be specified"
And no other errors or warnings are reported
@spec @xref:sec-meta-elem
Scenario: a metadata's property name must be well-formed
When checking file 'metadata-meta-property-malformed-error.opf'
Then error OPF-026 is reported
And no other errors or warnings are reported
Scenario: 'scheme' can be used to identify the value system
When checking file 'metadata-meta-scheme-valid.opf'
Then no errors or warnings are reported
@spec @xref:sec-meta-elem
Scenario: 'scheme' must not be list of values
When checking file 'metadata-meta-scheme-list-error.opf'
Then error RSC-005 is reported (value is not an NMTOKEN)
And error OPF-025 is reported
And no other errors or warnings are reported
@spec @xref:sec-meta-elem
Scenario: 'scheme' must not be an unknown value with no prefix
When checking file 'metadata-meta-scheme-unknown-error.opf'
Then error OPF-027 is reported
And no other errors or warnings are reported
### 5.5.6 Last modified date
@spec @xref:sec-metadata-last-modified
Scenario: 'dc:modified' must be defined
When checking file 'metadata-modified-missing-error.opf'
Then error RSC-005 is reported
And the message contains "dcterms:modified"
And no other errors or warnings are reported
@spec @xref:sec-metadata-last-modified
Scenario: 'dc:modified' must be of the form 'CCYY-MM-DDThh:mm:ssZ'
When checking file 'metadata-modified-syntax-error.opf'
Then error RSC-005 is reported
And the message contains "CCYY-MM-DDThh:mm:ssZ"
And no other errors or warnings are reported
### 5.5.7 The link element
Scenario: Report a package metadata link to a missing resource
When checking EPUB 'package-link-missing-resource-error'
Then warning RSC-007w is reported
And no other errors or warnings are reported
@spec @xref:sec-link-elem
Scenario: Report a missing 'media-type' attribute on links to container resources
When checking file 'package-link-media-type-missing-local-error'
Then error OPF-093 is reported
And no other errors or warnings are reported
@spec @xref:sec-link-elem
Scenario: Allow a missing 'media-type' attribute on links to remote resources
When checking file 'package-link-media-type-missing-remote-valid'
Then no errors or warnings are reported
@spec @xref:sec-link-elem
Scenario: the link 'rel' attribute can have multiple properties
When checking file 'link-rel-multiple-properties-valid.opf'
Then no errors or warnings are reported
@spec @xref:sec-link-elem
Scenario: the link 'properties' attribute must not be empty
When checking file 'link-rel-record-properties-empty-error.opf'
Then error RSC-005 is reported
And the message contains 'value of attribute "properties" is invalid'
And no other errors or warnings are reported
@spec @xref:sec-link-elem
Scenario: a link with an unknown 'properties' value is reported
When checking file 'link-rel-record-properties-undefined-error.opf'
Then error OPF-027 is reported
And no other errors or warnings are reported
Scenario: the 'link' element can have an 'hreflang' attribute
When checking file 'link-hreflang-valid.opf'
Then no other errors or warnings are reported
@spec @xref:sec-link-elem
Scenario: the 'link' 'hreflang' attribute can be empty
When checking file 'link-hreflang-empty-valid.opf'
Then no other errors or warnings are reported
@spec @xref:sec-link-elem
Scenario: the 'link' 'hreflang' language tag must not have leading/trailing whitespace
When checking file 'link-hreflang-whitespace-error.opf'
Then error OPF-092 is reported
And no other errors or warnings are reported
@spec @xref:sec-link-elem
Scenario: the 'link' 'hreflang' language tag must be well-formed
When checking file 'link-hreflang-not-well-formed-error.opf'
Then error OPF-092 is reported
And no other errors or warnings are reported
### 5.6 Manifest section
### 5.6.1 The manifest element
@spec @xref:sec-manifest-elem
Scenario: Report a remote image declared in the package document when it is referenced from an HTML `a` element
When checking EPUB 'package-remote-img-in-link-error'
Then error RSC-006 is reported
And no other errors or warnings are reported
@spec @xref:sec-manifest-elem
Scenario: Report remote audio resources not declared in the package document
When checking EPUB 'package-remote-audio-undeclared-error'
Then error RSC-008 is reported
And no other errors or warnings are reported
@spec @xref:sec-manifest-elem
Scenario: Report remote audio resources defined in `sources` elements but not declared in the package document
When checking EPUB 'package-remote-audio-sources-undeclared-error'
Then error RSC-008 is reported
And no other errors or warnings are reported
@spec @xref:sec-manifest-elem
Scenario: Report a remote font not declared in the package document
When checking EPUB 'package-remote-font-undeclared-error'
Then error RSC-008 is reported
And no other errors or warnings are reported
### 5.6.2 The item element
@spec @xref:sec-item-elem
Scenario: a manifest item must declare a media type
When checking file 'item-media-type-missing-error.opf'
Then error RSC-005 is reported
And the message contains 'missing required attribute "media-type"'
And no other errors or warnings are reported
Scenario: item URLs must be properly encoded
When checking file 'item-href-contains-spaces-unencoded-error.opf'
Then error RSC-020 is reported
And warning PKG-010 is reported (side effect of spaces)
And no other errors or warnings are reported
@spec @xref:sec-item-elem
Scenario: item URLs must not have a fragment identifier
When checking file 'item-href-with-fragment-error.opf'
Then error OPF-091 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-elem
Scenario: two manifest items cannot represent the same resource
When checking file 'item-duplicate-resource-error.opf'
Then error OPF-074 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-elem
Scenario: Report duplicate declarations of a resource in the package document manifest
When checking EPUB 'package-manifest-duplicate-resource-error'
Then error OPF-074 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-elem @xref:sec-container-iri
Scenario: Report a resource declared in the package document but missing from the container
When checking EPUB 'package-manifest-item-missing-error'
Then error RSC-001 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-elem @xref:attrdef-href
Scenario: Report a manifest item path with unencoded spaces
See issue #239 for why this needs to also be checked at the publication level
When checking file 'package-manifest-item-with-spaces-warning'
Then warning PKG-010 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-elem @xref:sec-container-iri
Scenario: Report fonts declared in the package document but missing from the container
When checking EPUB 'package-manifest-fonts-missing-error'
Then error RSC-001 is reported 3 times
And no other errors or warnings are reported
@spec @xref:sec-item-elem
Scenario: fallback attribute must point to an existing item ID
When checking file 'fallback-to-unknown-id-error.opf'
Then error OPF-040 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-elem
Scenario: fallback attribute must not reference its item ID
When checking file 'fallback-to-self-error.opf'
Then error OPF-045 is reported
And no other errors or warnings are reported
Scenario: Report usage of the EPUB 2 'fallback-style' attribute
When checking file 'fallback-style-error.opf'
Then error RSC-005 is reported
And the message contains 'fallback-style'
And no other errors or warnings are reported
#### 5.6.2.1 Resource properties
@spec @xref:sec-item-resource-properties
Scenario: An unknown item property in the default vocab is reported
When checking file 'item-property-unknown-error.opf'
Then error OPF-027 is reported
And no errors or warnings are reported
##### cover-image
@spec @xref:sec-item-resource-properties
Scenario: The 'cover-image' item property must occur at most once
When checking file 'item-property-cover-image-multiple-error.opf'
Then error RSC-005 is reported
And the message contains "cover-image"
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: The 'cover-image' item property must only be used on images
When checking file 'item-property-cover-image-wrongtype-error.opf'
Then error OPF-012 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report an unknown manifest item property
When checking EPUB 'package-manifest-prop-unknown-error'
Then error OPF-027 is reported
And no other errors or warnings are reported
##### mathml
@spec @xref:sec-item-resource-properties
Scenario: Verify content documents are identified as containing mathml
When checking EPUB 'package-mathml-valid'
Then no errors or warnings are reported
##### remote-resources
@spec @xref:sec-item-resource-properties
Scenario: Report an XHTML document with remote audio but without the `remote-resources` property set in the package document
When checking EPUB 'package-remote-audio-missing-property-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report remote fonts in CSS without the `remote-resource` property set in the package document
When checking EPUB 'package-remote-font-in-css-missing-property-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report a missing `remote-resources` property when inline CSS has remote references
When checking EPUB 'package-remote-font-in-inline-css-missing-property-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report an SVG using remote fonts without the `remote-resource` property set in the package document
When checking EPUB 'package-remote-font-in-svg-missing-property-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report an XHTML document using remote fonts in `style` without the `remote-resource` property set in the package document
When checking EPUB 'package-remote-font-in-xhtml-missing-property-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report the declaration of the `remote-resources` property when the content has no script
When checking EPUB 'package-manifest-prop-remote-resource-declared-but-unnecessary-error'
Then warning OPF-018 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report a reference a remote resource when the `remote-resources` property is not set in the manifest
When checking EPUB 'package-manifest-prop-remote-resource-undeclared-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report the incorrect use of the `remote-resources` property for a resource defined in an `object` `param` element (issue 249)
When checking EPUB 'package-manifest-prop-remote-resource-object-param-warning'
Then warning OPF-018 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report a media overlay document with remote resources but missing the `remote-resources` property
When checking EPUB 'package-remote-audio-in-overlays-missing-property-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Verify that inline CSS does not trigger an unrequired `remote-resources` property error
When checking EPUB 'package-remote-resource-and-inline-css-valid'
Then no errors or warnings are reported
##### scripted
@spec @xref:sec-item-resource-properties
Scenario: Report the declaration of the `scripted` property when the content has no script
When checking EPUB 'package-manifest-prop-scripted-declared-but-unnecessary-error'
Then error OPF-015 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report a scripted document (javascript) without the `scripted` property declared in the package document
When checking EPUB 'package-manifest-prop-scripted-undeclared-javascript-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report a scripted document (form) without the `scripted` property declared in the package document
When checking EPUB 'package-manifest-prop-scripted-undeclared-form-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Verify that script data blocks do not require the `scripted` property to be defined in the manifest
When checking EPUB 'package-manifest-prop-scripted-not-required-for-script-data-block-valid'
Then no errors or warnings are reported
##### svg
@spec @xref:sec-item-resource-properties
Scenario: Report the declaration of the `svg` property when the content has no embedded SVG
When checking EPUB 'package-manifest-prop-svg-declared-but-unnecessary-error'
Then error OPF-015 is reported
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report references to embedded SVG when the `svg` property is not set in the manifest
When checking EPUB 'package-manifest-prop-svg-undeclared-error'
Then error OPF-014 is reported 2 times
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: Report reference to an embedded SVG when the `svg` property is not set in the manifest (one reference is set properly)
When checking EPUB 'package-manifest-prop-svg-undeclared-partial-error'
Then error OPF-014 is reported
And no other errors or warnings are reported
##### switch
@spec @xref:sec-item-resource-properties
Scenario: Report a content document without the `switch` property declared in the manifest
When checking EPUB 'package-manifest-prop-switch-not-declared-error'
Then error OPF-014 is reported
And warning RSC-017 is reported
And the message contains 'The "epub:switch" element is deprecated'
And no other errors or warnings are reported
##### nav
@spec @xref:sec-item-resource-properties
Scenario: one item must have the 'nav' property
When checking file 'item-nav-missing-error.opf'
Then error RSC-005 is reported
And the message contains 'Exactly one manifest item must declare the "nav" property'
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: at most one item must have the 'nav' property
When checking file 'item-nav-multiple-error.opf'
Then error RSC-005 is reported
And the message contains 'Exactly one manifest item must declare the "nav" property'
And no other errors or warnings are reported
@spec @xref:sec-item-resource-properties
Scenario: the 'nav' property must be on an XHTML Content Document
When checking file 'item-nav-not-xhtml-error.opf'
Then error RSC-005 is reported
And the message contains 'the Navigation Document must be of the "application/xhtml+xml" type'
And error OPF-012 is reported ('nav' undefined for 'application/x+dtbncx+xml')
And no other errors or warnings are reported
#### 5.6.3 The bindings Element
Scenario: Report usage of the 'bindings' element as deprecated
When checking file 'bindings-deprecated-warning.opf'
Then warning RSC-017 is reported
And no other errors or warnings are reported
### 5.7 Spine section
#### 5.7.1 The spine element
@spec @xref:sec-spine-elem
Scenario: Report a missing spine
When checking EPUB 'package-spine-missing-error'
Then the following errors are reported
| RSC-005 | missing required element "spine" |
| RSC-011 | reference to a resource that is not a spine item | # in the Nav Doc
And no other errors or warnings are reported
#### 5.7.2 The itemref element
@spec @xref:sec-itemref-elem
Scenario: An SVG Content Document is allowed in the spine
When checking file 'spine-item-svg-valid.opf'
Then no errors or warnings are reported
@spec @xref:sec-itemref-elem
Scenario: An unknown 'itemref' ID is reported
When checking file 'spine-item-unknown-error.opf'
Then error OPF-049 is reported (ID not found)
Then error RSC-005 is reported (schema error)
And no other errors or warnings are reported
@spec @xref:sec-itemref-elem
Scenario: Two spine 'itemref' elements cannot reference the same manifest item
When checking file 'spine-item-duplicate-error.opf'
Then error RSC-005 is reported
And the message contains "Itemref refers to the same manifest entry as a previous itemref"
And no other errors or warnings are reported
## 5.8 Collections
### 5.8.1 The collection element
@spec @xref:sec-collection-elem
Scenario: a collection role can be an absolute URL
When checking file 'collection-role-url-valid.opf'
Then no errors or warnings are reported
@spec @xref:sec-collection-elem
Scenario: a collection role must not be an invalid URL
Spec mismatch: this should be reported as an error
When checking file 'collection-role-url-invalid-error.opf'
Then warning OPF-070 is reported
And no other errors or warnings are reported
Scenario: a 'manifest' collection must be the child of another collection
See http://idpf.org/epub/vocab/package/roles/manifest/
When checking file 'collection-role-manifest-toplevel-error.opf'
Then error RSC-005 is reported
And the message contains "A manifest collection must be the child of another collection"
And no other errors or warnings are reported
## 5.9 Legacy content
#### 5.9.1 The meta element
#### 5.9.2 The guide element
Scenario: 'guide' should not contain two entries of the same type pointing to the same resource
When checking EPUB 'legacy-guide-duplicates-warning.opf'
Then warning RSC-017 is reported 2 times (once for each entry)
And the message contains 'Duplicate "reference" elements with the same "type" and "href" attributes'
And no other errors or warnings are reported
#### 5.9.3 NCX
Scenario: When an NCX document is present, it must be identified in the 'toc' attribute of the spine
When checking file 'legacy-ncx-toc-attribute-missing-error.opf'
Then error RSC-005 is reported
And the message contains "toc attribute must be set"
And no other errors or warnings are reported
Scenario: The 'toc' attribute of the spine must point to an NCX document
When checking file 'legacy-ncx-toc-attribute-not-ncx-error.opf'
Then error OPF-050 is reported
Then error RSC-005 is reported (duplicate schema error)
And no other errors or warnings are reported
Scenario: Verify a publication featuring a legacy NCX navigation document
When checking EPUB 'package-ncx-valid'
Then no errors or warnings are reported
Scenario: Report validation errors in legacy NCX documents
When checking EPUB 'package-ncx-invalid-error'
Then error RSC-012 is reported
And the message contains 'Fragment identifier is not defined'
And no other errors or warnings are reported
Scenario: Verify an NCX which does not link to all spine items
Given the reporting level set to USAGE
When checking EPUB 'package-ncx-missing-references-to-spine-valid'
Then no errors or warnings are reported