Auto center/center to parent element
@@ -331,6 +331,18 @@
assert.isTrue(rect.height <= crect.height, 'height is less than or equal to fitInto height');
});
+ test('element centers in another element', function() {
+ var constrain = fixture('constrain-target');
+ var el = Polymer.dom(constrain).querySelector('.el')
+ makeScrolling(el);
+ el.fitInto = constrain;
+ el.refit();
+ var rect = el.getBoundingClientRect();
+ var crect = constrain.getBoundingClientRect();
+ assert.closeTo(rect.left - crect.left - (crect.right - rect.right), 0, 5, 'centered horizontally in fitInto');
+ assert.closeTo(rect.top - crect.top - (crect.bottom - rect.bottom), 0, 5, 'centered vertically in fitInto');
+ });
+
});