- it('reads node\'s metadata from its metadata child node', function() {
- var doc = getDocumentFromXML('<section><metadata><dc:key>value</dc:key></metadata></section>');
- expect(doc.root.getMetadata()).to.deep.equal([{key: 'key', value: 'value'}]);
+ var row = doc.root.addMetadata({key: 'key', value: 'value'}),
+ metadata = doc.root.getMetadata();
+
+ expect(metadata.length).to.equal(1);
+ expect(metadata[0]).to.equal(row, 'aaa');
+
+ expect(row.getKey()).to.equal('key');
+ expect(row.getValue()).to.equal('value');
+ });
+ // it('allows to remove specific metadata row', function() {
+ // var doc = getDocumentFromXML('<section><metadata><dc:key>value</dc:key><dc:key>value</dc:key></metadata></section>'),
+ // metadata = doc.root.getMetadata();
+ // expect(metadata.length).to.equal(2);
+ // row.remove();
+ // expect(metadata.length)
+ // expect(metadata[0].getValue()).to.equal('value');
+ // });
+ it('reads node\'s metadata from source of its metadata child node', function() {
+ var doc = getDocumentFromXML('<section><metadata><dc:key>value</dc:key></metadata></section>'),
+ metadata = doc.root.getMetadata();
+ expect(metadata.length).to.equal(1);
+ expect(metadata[0].getKey()).to.equal('key');
+ expect(metadata[0].getValue()).to.equal('value');