@@ -43,7 +43,11 @@ const testXml = `
43
43
` ;
44
44
45
45
async function annotate ( json ) {
46
- const res = await util . axios . post ( 'annotations/merge/annotate%2Fannotations.xml' , json ) ;
46
+ const res = await util . axios . post ( 'annotations/merge/annotate%2Fannotations.xml' , json , {
47
+ headers : {
48
+ 'Content-Type' : 'application/json'
49
+ }
50
+ } ) ;
47
51
expect ( res . status ) . to . equal ( 200 ) ;
48
52
expect ( res ) . to . satisfyApiSpec ;
49
53
expect ( res . data . changes ) . to . have . length ( 1 ) ;
@@ -69,7 +73,8 @@ describe('/api/annotations/merge', function() {
69
73
} ) ;
70
74
71
75
it ( 'deletes at start and wraps' , async function ( ) {
72
- const document = await annotate ( [
76
+ const document = await annotate ( {
77
+ annotations : [
73
78
{
74
79
"type" : "delete" ,
75
80
"node" : "1.4.2.2.2" ,
@@ -101,13 +106,14 @@ describe('/api/annotations/merge', function() {
101
106
"target" : "#foo"
102
107
}
103
108
}
104
- ] ) ;
109
+ ] } ) ;
105
110
const para = document . querySelector ( "body p:nth-child(1)" ) ;
106
111
expect ( para . outerHTML ) . xml . to . equal ( '<p xmlns="http://www.tei-c.org/ns/1.0">(<ref target="#foo"><hi>Gauger I</hi>, <hi>113</hi></ref>).</p>' ) ;
107
112
} ) ;
108
113
109
114
it ( 'deletes at end and wraps' , async function ( ) {
110
- const document = await annotate ( [
115
+ const document = await annotate ( {
116
+ annotations : [
111
117
{
112
118
"type" : "delete" ,
113
119
"node" : "1.4.2.4.2" ,
@@ -139,13 +145,14 @@ describe('/api/annotations/merge', function() {
139
145
"target" : "#foo"
140
146
}
141
147
}
142
- ] ) ;
148
+ ] } ) ;
143
149
const para = document . querySelector ( "body p:nth-child(2)" ) ;
144
150
expect ( para . outerHTML ) . xml . to . equal ( '<p xmlns="http://www.tei-c.org/ns/1.0">(<ref target="#foo"><hi>113</hi>, <hi>Gauger I</hi></ref>).</p>' ) ;
145
151
} ) ;
146
152
147
153
it ( 'annotate after nested note' , async function ( ) {
148
- const document = await annotate ( [
154
+ const document = await annotate ( {
155
+ annotations : [
149
156
{
150
157
"context" : "1.4.2.8" ,
151
158
"start" : 20 ,
@@ -154,13 +161,14 @@ describe('/api/annotations/merge', function() {
154
161
"type" : "hi" ,
155
162
"properties" : { }
156
163
}
157
- ] ) ;
164
+ ] } ) ;
158
165
const para = document . querySelector ( "body p:nth-child(4)" ) ;
159
166
expect ( para . outerHTML ) . xml . to . equal ( '<p xmlns="http://www.tei-c.org/ns/1.0"><ref target="#">Starb am<note place="footnote">Fehlt.</note></ref>. Sammlung: <hi>Opuscula theologica</hi>.</p>' ) ;
160
167
} ) ;
161
168
162
169
it ( 'wrap to end of paragraph' , async function ( ) {
163
- const document = await annotate ( [
170
+ const document = await annotate ( {
171
+ annotations : [
164
172
{
165
173
"context" : "1.4.2.16" ,
166
174
"start" : 210 ,
@@ -171,13 +179,14 @@ describe('/api/annotations/merge', function() {
171
179
"target" : "#foo"
172
180
}
173
181
}
174
- ] ) ;
182
+ ] } ) ;
175
183
const para = document . querySelector ( "body p:nth-child(8)" ) ;
176
184
expect ( para . outerHTML ) . xml . to . equal ( '<p xmlns="http://www.tei-c.org/ns/1.0">Bei <persName type="author" ref="kbga-actors-8470">Budé</persName> (Anm. 21), S. 56f.59, finden sich zwei Briefe von Fontenelle an Turettini, in denen <persName ref="kbga-actors-8482">Fontenelle</persName> sich lobend über <persName ref="kbga-actors-1319">Werenfels</persName> äußert. Den erwähnten Dank formulierte <persName ref="kbga-actors-1319">Werenfels</persName> in Form eines Epigramms; vgl. <ref target="#foo"><persName type="author" ref="kbga-actors-1319">S. Werenfels</persName>, <hi rend="i">Fasciculus Epigrammatum</hi>, in: ders., <hi rend="i">Opuscula</hi> III (Anm. 20), S. 337–428, dort S. 384:</ref></p>' ) ;
177
185
} ) ;
178
186
179
187
it ( 'annotate after nested choice' , async function ( ) {
180
- const document = await annotate ( [
188
+ const document = await annotate ( {
189
+ annotations : [
181
190
{
182
191
"context" : "1.4.2.10" ,
183
192
"start" : 9 ,
@@ -186,13 +195,14 @@ describe('/api/annotations/merge', function() {
186
195
"type" : "hi" ,
187
196
"properties" : { }
188
197
}
189
- ] ) ;
198
+ ] } ) ;
190
199
const para = document . querySelector ( "body p:nth-child(5)" ) ;
191
200
expect ( para . outerHTML ) . xml . to . equal ( '<p xmlns="http://www.tei-c.org/ns/1.0"><hi>Zum <choice><abbr>Bsp.</abbr><expan>Beispiel</expan></choice></hi> <hi>Opuscula theologica</hi>.</p>' ) ;
192
201
} ) ;
193
202
194
203
it ( 'insert choice/abbr/expan' , async function ( ) {
195
- const document = await annotate ( [
204
+ const document = await annotate ( {
205
+ annotations : [
196
206
{
197
207
"context" : "1.4.2.12" ,
198
208
"start" : 6 ,
@@ -203,13 +213,14 @@ describe('/api/annotations/merge', function() {
203
213
"expan" : "sit amet"
204
214
}
205
215
}
206
- ] ) ;
216
+ ] } ) ;
207
217
const para = document . querySelector ( "body p:nth-child(6)" ) ;
208
218
expect ( para . outerHTML ) . xml . to . equal ( '<p xmlns="http://www.tei-c.org/ns/1.0">Lorem <choice><abbr>ipsum dolor</abbr><expan>sit amet</expan></choice> sit amet.</p>' ) ;
209
219
} ) ;
210
220
211
221
it ( 'insert app/lem/rdg' , async function ( ) {
212
- const document = await annotate ( [
222
+ const document = await annotate ( {
223
+ annotations : [
213
224
{
214
225
"context" : "1.4.2.12" ,
215
226
"start" : 6 ,
@@ -221,31 +232,33 @@ describe('/api/annotations/merge', function() {
221
232
"rdg[1]" : "sit amet"
222
233
}
223
234
}
224
- ] ) ;
235
+ ] } ) ;
225
236
const para = document . querySelector ( "body p:nth-child(6)" ) ;
226
237
expect ( para . outerHTML ) . xml . to . equal ( '<p xmlns="http://www.tei-c.org/ns/1.0">Lorem <app><lem>ipsum dolor</lem><rdg wit="#me">sit amet</rdg></app> sit amet.</p>' ) ;
227
238
} ) ;
228
239
229
240
it ( 'delete choice/abbr/expan' , async function ( ) {
230
- const document = await annotate ( [
241
+ const document = await annotate ( {
242
+ annotations : [
231
243
{
232
244
"type" : "delete" ,
233
245
"node" : "1.4.2.14.2" ,
234
246
"context" : "1.4.2.14"
235
247
}
236
- ] ) ;
248
+ ] } ) ;
237
249
const para = document . querySelector ( "body p:nth-child(7)" ) ;
238
250
expect ( para . outerHTML ) . xml . to . equal ( '<p xmlns="http://www.tei-c.org/ns/1.0">Lorem ipsum dolor sit amet.</p>' ) ;
239
251
} ) ;
240
252
241
253
it ( 'delete element containing note' , async function ( ) {
242
- const document = await annotate ( [
254
+ const document = await annotate ( {
255
+ annotations : [
243
256
{
244
257
"type" : "delete" ,
245
258
"node" : "1.4.2.8.1" ,
246
259
"context" : "1.4.2.8"
247
260
}
248
- ] ) ;
261
+ ] } ) ;
249
262
const para = document . querySelector ( "body p:nth-child(4)" ) ;
250
263
expect ( para . outerHTML ) . xml . to . equal ( '<p xmlns="http://www.tei-c.org/ns/1.0">Starb am<note place="footnote">Fehlt.</note>. Sammlung: Opuscula theologica.</p>' ) ;
251
264
} ) ;
0 commit comments