From b4f3f9be95d6b0a454e18389bb0903e0cd63ae53 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Fri, 7 Feb 2014 10:13:30 +0100 Subject: [PATCH] wlxml: regression test --- .../extensions/metadata/metadata.test.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/wlxml/extensions/metadata/metadata.test.js b/src/wlxml/extensions/metadata/metadata.test.js index 422a371..ca6c309 100644 --- a/src/wlxml/extensions/metadata/metadata.test.js +++ b/src/wlxml/extensions/metadata/metadata.test.js @@ -125,6 +125,27 @@ describe('Metadata API', function() { doc.redo(); expect(metadata.length).to.equal(0, 'redo removed metadata'); }); + + describe('Regression tests', function() { + it('passes undoing & redoing scenario', function() { + var doc = getDocumentFromXML('
'); + + doc.startTransaction(); + var comment = doc.root.append({tagName: 'aside', attrs: {klass: 'comment'}}); + comment.append({text: ''}); + var meta = comment.getMetadata(); + meta.add({key: 'k', value: '1'}); + doc.endTransaction(); + + doc.undo(); + doc.redo(); + + comment = doc.root.contents()[0]; + expect(comment.getMetadata().length).to.equal(1); + doc.undo(); + expect(doc.root.contents().length).to.equal(0); + }); + }); }); -- 2.20.1