Cleanup scrollWidth test case to not need teardown
Instead of mutative the div#mock, insert a container into it that has
the desired properties and insert the math field into that, that way the
container will get destroyed by the global teardown.
diff --git a/test/unit/css.test.js b/test/unit/css.test.js
index 4388df6..5cc6fb7 100644
--- a/test/unit/css.test.js
+++ b/test/unit/css.test.js
@@ -1,22 +1,16 @@
suite('CSS', function() {
test('math field doesn\'t fuck up ancestor\'s .scrollWidth', function() {
- var mock = $('#mock').css({
+ var container = $('<div>').css({
fontSize: '16px',
height: '25px', // must be greater than font-size * 115% + 2 * 2px (padding) + 2 * 1px (border)
width: '25px'
- })[0];
- assert.equal(mock.scrollHeight, 25);
- assert.equal(mock.scrollWidth, 25);
+ }).appendTo('#mock')[0];
+ assert.equal(container.scrollHeight, 25);
+ assert.equal(container.scrollWidth, 25);
- var mq = MQ.MathField($('<span style="box-sizing:border-box;height:100%;width:100%"></span>').appendTo(mock)[0]);
- assert.equal(mock.scrollHeight, 25);
- assert.equal(mock.scrollWidth, 25);
-
- $(mock).css({
- fontSize: '',
- height: '',
- width: ''
- });
+ var mq = MQ.MathField($('<span style="box-sizing:border-box;height:100%;width:100%"></span>').appendTo(container)[0]);
+ assert.equal(container.scrollHeight, 25);
+ assert.equal(container.scrollWidth, 25);
});
test('empty root block does not collapse', function() {