diff --git a/test/contextmenu_test.html b/test/contextmenu_test.html
index e528840a..fb95423c 100644
--- a/test/contextmenu_test.html
+++ b/test/contextmenu_test.html
@@ -1,82 +1,82 @@
-
-
-
-
-
-
+
+
+
+
+ equals(svgedit.contextmenu.getCustomHandler("valid"),validItem1.action,"duplicate menu item is rejected.");
+ tearDown();
+ });
+ });
+
-
-
-
-
-
-
+
+
+
+
+
diff --git a/test/coords_test.html b/test/coords_test.html
index f56c8131..e8e3113f 100644
--- a/test/coords_test.html
+++ b/test/coords_test.html
@@ -1,6 +1,7 @@
+ Unit Tests for coords.js
@@ -326,8 +327,7 @@
-
-
+
diff --git a/test/draw_test.html b/test/draw_test.html
index fd4788da..75e52665 100644
--- a/test/draw_test.html
+++ b/test/draw_test.html
@@ -1,535 +1,534 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ });
+
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/test/history_test.html b/test/history_test.html
index d1d2d3e3..5850935c 100644
--- a/test/history_test.html
+++ b/test/history_test.html
@@ -1,589 +1,589 @@
-
-
-
-
-
+
+
+
+ move.apply();
+ equals(divparent.firstElementChild, div1);
+ equals(divparent.firstElementChild.nextElementSibling, div2);
+ equals(divparent.lastElementChild, div3);
+ equals(div4.firstElementChild, div5);
+ equals(div4.lastElementChild, div5);
+
+ tearDown();
+ });
+
+ test('Test InsertElementCommand', function() {
+ expect(20);
+
+ setUp();
+
+ var insert = new svgedit.history.InsertElementCommand(div3);
+ ok(insert.unapply);
+ ok(insert.apply);
+ equals(typeof insert.unapply, typeof function(){});
+ equals(typeof insert.apply, typeof function(){});
+
+ insert.unapply();
+ equals(divparent.childElementCount, 2);
+ equals(divparent.firstElementChild, div1);
+ equals(div1.nextElementSibling, div2);
+ equals(divparent.lastElementChild, div2);
+
+ insert.apply();
+ equals(divparent.childElementCount, 3);
+ equals(divparent.firstElementChild, div1);
+ equals(div1.nextElementSibling, div2);
+ equals(div2.nextElementSibling, div3);
+
+ insert = new svgedit.history.InsertElementCommand(div2);
+
+ insert.unapply();
+ equals(divparent.childElementCount, 2);
+ equals(divparent.firstElementChild, div1);
+ equals(div1.nextElementSibling, div3);
+ equals(divparent.lastElementChild, div3);
+
+ insert.apply();
+ equals(divparent.childElementCount, 3);
+ equals(divparent.firstElementChild, div1);
+ equals(div1.nextElementSibling, div2);
+ equals(div2.nextElementSibling, div3);
+
+ tearDown();
+ });
+
+ test('Test RemoveElementCommand', function() {
+ expect(22);
+
+ setUp();
+
+ var div6 = document.createElement('div');
+ div6.id = 'div6';
+
+ var remove = new svgedit.history.RemoveElementCommand(div6, null, divparent);
+ ok(remove.unapply);
+ ok(remove.apply);
+ equals(typeof remove.unapply, typeof function(){});
+ equals(typeof remove.apply, typeof function(){});
+
+ remove.unapply();
+ equals(divparent.childElementCount, 4);
+ equals(divparent.firstElementChild, div1);
+ equals(div1.nextElementSibling, div2);
+ equals(div2.nextElementSibling, div3);
+ equals(div3.nextElementSibling, div6);
+
+ remove.apply();
+ equals(divparent.childElementCount, 3);
+ equals(divparent.firstElementChild, div1);
+ equals(div1.nextElementSibling, div2);
+ equals(div2.nextElementSibling, div3);
+
+ remove = new svgedit.history.RemoveElementCommand(div6, div2, divparent);
+
+ remove.unapply();
+ equals(divparent.childElementCount, 4);
+ equals(divparent.firstElementChild, div1);
+ equals(div1.nextElementSibling, div6);
+ equals(div6.nextElementSibling, div2);
+ equals(div2.nextElementSibling, div3);
+
+ remove.apply();
+ equals(divparent.childElementCount, 3);
+ equals(divparent.firstElementChild, div1);
+ equals(div1.nextElementSibling, div2);
+ equals(div2.nextElementSibling, div3);
+
+ tearDown();
+ });
+
+ test('Test ChangeElementCommand', function() {
+ expect(26);
+
+ setUp();
+
+ div1.setAttribute('title', 'new title');
+ var change = new svgedit.history.ChangeElementCommand(div1,
+ {'title': 'old title', 'class': 'foo'});
+ ok(change.unapply);
+ ok(change.apply);
+ equals(typeof change.unapply, typeof function(){});
+ equals(typeof change.apply, typeof function(){});
+
+ change.unapply();
+ equals(div1.getAttribute('title'), 'old title');
+ equals(div1.getAttribute('class'), 'foo');
+
+ change.apply();
+ equals(div1.getAttribute('title'), 'new title');
+ ok(!div1.getAttribute('class'));
+
+ div1.textContent = 'inner text';
+ change = new svgedit.history.ChangeElementCommand(div1,
+ {'#text': null});
+
+ change.unapply();
+ ok(!div1.textContent);
+
+ change.apply();
+ equals(div1.textContent, 'inner text');
+
+ div1.textContent = '';
+ change = new svgedit.history.ChangeElementCommand(div1,
+ {'#text': 'old text'});
+
+ change.unapply();
+ equals(div1.textContent, 'old text');
+
+ change.apply();
+ ok(!div1.textContent);
+
+ // TODO(codedread): Refactor this #href stuff in history.js and svgcanvas.js
+ var rect = document.createElementNS(NS.SVG, 'rect');
+ var justCalled = null;
+ var gethrefvalue = null;
+ var sethrefvalue = null;
+ svgedit.utilities.getHref = function(elem) {
+ equals(elem, rect);
+ justCalled = 'getHref';
+ return gethrefvalue;
+ };
+ svgedit.utilities.setHref = function(elem, val) {
+ equals(elem, rect);
+ equals(val, sethrefvalue);
+ justCalled = 'setHref';
+ };
+
+ gethrefvalue = '#newhref';
+ change = new svgedit.history.ChangeElementCommand(rect,
+ {'#href': '#oldhref'});
+ equals(justCalled, 'getHref');
+
+ justCalled = null;
+ sethrefvalue = '#oldhref';
+ change.unapply();
+ equals(justCalled, 'setHref');
+
+ justCalled = null;
+ sethrefvalue = '#newhref';
+ change.apply();
+ equals(justCalled, 'setHref');
+
+ var line = document.createElementNS(NS.SVG,'line');
+ line.setAttributeNS(null, 'class', 'newClass');
+ change = new svgedit.history.ChangeElementCommand(line,{class:'oldClass'});
+
+ ok(change.unapply);
+ ok(change.apply);
+ equals(typeof change.unapply, typeof function(){});
+ equals(typeof change.apply, typeof function(){});
+
+ change.unapply();
+ equals(line.getAttributeNS(null, 'class'), 'oldClass');
+
+ change.apply();
+ equals(line.getAttributeNS(null, 'class'), 'newClass');
+
+ tearDown();
+ });
+
+ test('Test BatchCommand', function() {
+ expect(13);
+
+ setUp();
+
+ var concatResult = '';
+ MockCommand.prototype.apply = function() { concatResult += this.text_; };
+
+ var batch = new svgedit.history.BatchCommand();
+ ok(batch.unapply);
+ ok(batch.apply);
+ ok(batch.addSubCommand);
+ ok(batch.isEmpty);
+ equals(typeof batch.unapply, typeof function(){});
+ equals(typeof batch.apply, typeof function(){});
+ equals(typeof batch.addSubCommand, typeof function(){});
+ equals(typeof batch.isEmpty, typeof function(){});
+
+ ok(batch.isEmpty());
+
+ batch.addSubCommand(new MockCommand('a'));
+ ok(!batch.isEmpty());
+ batch.addSubCommand(new MockCommand('b'));
+ batch.addSubCommand(new MockCommand('c'));
+
+ ok(!concatResult);
+ batch.apply();
+ equals(concatResult, 'abc');
+
+ MockCommand.prototype.apply = function() {};
+ MockCommand.prototype.unapply = function() { concatResult += this.text_; };
+ concatResult = '';
+ batch.unapply();
+ equals(concatResult, 'cba');
+
+ MockCommand.prototype.unapply = function() {};
+
+ tearDown();
+ });
+
+ });
+
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/test/math_test.html b/test/math_test.html
index 72fa9718..6dfc28ac 100644
--- a/test/math_test.html
+++ b/test/math_test.html
@@ -1,138 +1,138 @@
-
-
-
-
-
-
+
+
+
+
+ var r = transformBox(10, 10, 200, 300, m);
+ equals(r.tl.x, 10);
+ equals(r.tl.y, 10);
+ equals(r.tr.x, 210);
+ equals(r.tr.y, 10);
+ equals(r.bl.x, 10);
+ equals(r.bl.y, 310);
+ equals(r.br.x, 210);
+ equals(r.br.y, 310);
+ equals(r.aabox.x, 10);
+ equals(r.aabox.y, 10);
+ equals(r.aabox.width, 200);
+ equals(r.aabox.height, 300);
+ });
+ });
+
-
-
-
-
-
+
+
+
+
diff --git a/test/path_test.html b/test/path_test.html
index b0ea58a2..ccbc09b3 100644
--- a/test/path_test.html
+++ b/test/path_test.html
@@ -1,28 +1,27 @@
-
-
-
-
-
+ Unit Tests for path.js
+
+
+
+
+
-
-
-
-
+
+
diff --git a/test/sanitize_test.html b/test/sanitize_test.html
index f8a320eb..d5eeea5f 100644
--- a/test/sanitize_test.html
+++ b/test/sanitize_test.html
@@ -1,16 +1,17 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ });
+
-
-
-
-
-
-
+
+
+
+
+
diff --git a/test/svgtransformlist_test.html b/test/svgtransformlist_test.html
index 3e80fa12..1e006ca2 100644
--- a/test/svgtransformlist_test.html
+++ b/test/svgtransformlist_test.html
@@ -1,415 +1,415 @@
-
-
-
-
-
-
-
+
+
+
+
+
+ });
+
-
-
-
-
-
-
+
+
+
+
+
diff --git a/test/svgutils_test.html b/test/svgutils_test.html
index 78e75103..378418a9 100644
--- a/test/svgutils_test.html
+++ b/test/svgutils_test.html
@@ -1,133 +1,133 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ });
+
-
-
-
-
-
+
+
+
+
diff --git a/test/test1.html b/test/test1.html
index e07b9569..d1edb7fd 100644
--- a/test/test1.html
+++ b/test/test1.html
@@ -1,6 +1,7 @@
+ Unit Tests for SvgCanvas
@@ -22,248 +23,248 @@
@@ -271,14 +272,13 @@
-
-
+
-