blob: a017315ebe316b21fc5f4323e78db45c246a718c (
plain)
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
|
var assert = require("assert");
var xml = require("../../lib/xml");
var officeXmlReader = require("../../lib/docx/office-xml-reader");
var test = require("../test")(module);
test("mc:AlternateContent", {
"when mc:Fallback is present then mc:Fallback is read": function() {
var xmlString =
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
'<numbering xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">' +
'<mc:AlternateContent>' +
'<mc:Choice Requires="w14">' +
'<choice/>' +
'</mc:Choice>' +
'<mc:Fallback>' +
'<fallback/>' +
'</mc:Fallback>' +
'</mc:AlternateContent>' +
'</numbering>';
return officeXmlReader.read(xmlString).then(function(element) {
assert.deepEqual(element.children, [xml.element("fallback")]);
});
},
"when mc:Fallback is not present then element is ignored": function() {
var xmlString =
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
'<numbering xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">' +
'<mc:AlternateContent>' +
'<mc:Choice Requires="w14">' +
'<choice/>' +
'</mc:Choice>' +
'</mc:AlternateContent>' +
'</numbering>';
return officeXmlReader.read(xmlString).then(function(element) {
assert.deepEqual(element.children, []);
});
}
});
|