Permalink
Browse files

Add some contextual messages for DOM unit tests.

  • Loading branch information...
1 parent 82d44de commit 46b96b9571cfd5abcdd4f816b7eaeceb12b81d06 @savetheclocktower savetheclocktower committed Mar 31, 2010
Showing with 26 additions and 21 deletions.
  1. +26 −21 test/unit/dom_test.js
View
47 test/unit/dom_test.js
@@ -1143,8 +1143,8 @@ new Test.Unit.Runner({
},
testElementGetWidth: function() {
- this.assertIdentical(200, $('dimensions-visible').getWidth());
- this.assertIdentical(200, $('dimensions-display-none').getWidth());
+ this.assertIdentical(200, $('dimensions-visible').getWidth(), '#dimensions-visible');
+ this.assertIdentical(200, $('dimensions-display-none').getWidth(), '#dimensions-display-none');
},
testElementGetDimensions: function() {
@@ -1297,35 +1297,35 @@ new Test.Unit.Runner({
testPositionedOffset: function() {
this.assertEnumEqual([10,10],
- $('body_absolute').positionedOffset());
+ $('body_absolute').positionedOffset(), '#body_absolute');
this.assertEnumEqual([10,10],
- $('absolute_absolute').positionedOffset());
+ $('absolute_absolute').positionedOffset(), '#absolute_absolute');
this.assertEnumEqual([10,10],
- $('absolute_relative').positionedOffset());
+ $('absolute_relative').positionedOffset(), '#absolute_relative');
this.assertEnumEqual([0,10],
- $('absolute_relative_undefined').positionedOffset());
+ $('absolute_relative_undefined').positionedOffset(), '#absolute_relative_undefined');
this.assertEnumEqual([10,10],
- $('absolute_fixed_absolute').positionedOffset());
+ $('absolute_fixed_absolute').positionedOffset(), '#absolute_fixed_absolute');
var afu = $('absolute_fixed_undefined');
this.assertEnumEqual([afu.offsetLeft, afu.offsetTop],
- afu.positionedOffset());
+ afu.positionedOffset(), '#absolute_fixed_undefined');
var element = new Element('div'), offset = element.positionedOffset();
- this.assertEnumEqual([0,0], offset);
- this.assertIdentical(0, offset.top);
- this.assertIdentical(0, offset.left);
+ this.assertEnumEqual([0,0], offset, 'new element');
+ this.assertIdentical(0, offset.top, 'new element top');
+ this.assertIdentical(0, offset.left, 'new element left');
},
testCumulativeOffset: function() {
var element = new Element('div'), offset = element.cumulativeOffset();
- this.assertEnumEqual([0,0], offset);
- this.assertIdentical(0, offset.top);
- this.assertIdentical(0, offset.left);
+ this.assertEnumEqual([0,0], offset, 'new element');
+ this.assertIdentical(0, offset.top, 'new element top');
+ this.assertIdentical(0, offset.left, 'new element left');
var innerEl = new Element('div'), outerEl = new Element('div');
outerEl.appendChild(innerEl);
- this.assertEnumEqual([0,0], innerEl.cumulativeOffset());
+ this.assertEnumEqual([0,0], innerEl.cumulativeOffset(), 'new inner element');
},
testViewportOffset: function() {
@@ -1344,12 +1344,17 @@ new Test.Unit.Runner({
},
testOffsetParent: function() {
- this.assertEqual('body_absolute', $('absolute_absolute').getOffsetParent().id);
- this.assertEqual('body_absolute', $('absolute_relative').getOffsetParent().id);
- this.assertEqual('absolute_relative', $('inline').getOffsetParent().id);
- this.assertEqual('absolute_relative', $('absolute_relative_undefined').getOffsetParent().id);
-
- this.assertEqual(document.body, new Element('div').getOffsetParent());
+ this.assertEqual('body_absolute', $('absolute_absolute').getOffsetParent().id,
+ '#body_absolute should be parent of #absolute_absolute');
+ this.assertEqual('body_absolute', $('absolute_relative').getOffsetParent().id,
+ '#body_absolute should be parent of #absolute_relative');
+ this.assertEqual('absolute_relative', $('inline').getOffsetParent().id,
+ '#absolute_relative should be parent of #inline');
+ this.assertEqual('absolute_relative', $('absolute_relative_undefined').getOffsetParent().id,
+ '#absolute_relative should be parent of #absolute_relative_undefined');
+
+ this.assertEqual(document.body, new Element('div').getOffsetParent(),
+ 'body should be parent of unattached element');
},
testAbsolutize: function() {

0 comments on commit 46b96b9

Please sign in to comment.