mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge pull request #3982 from panda01/fix/2986/useNativeWidthToStopReflow
Use native width and height to stop Reflows
This commit is contained in:
commit
881ab58718
2 changed files with 9 additions and 14 deletions
|
@ -52,8 +52,8 @@ define(function (require) {
|
|||
*/
|
||||
ResizeChecker.prototype.read = function () {
|
||||
return {
|
||||
w: this.$el.width(),
|
||||
h: this.$el.height()
|
||||
w: this.$el[0].clientWidth,
|
||||
h: this.$el[0].clientHeight
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -204,4 +204,4 @@ define(function (require) {
|
|||
|
||||
return ResizeChecker;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -59,17 +59,12 @@ define(function (require) {
|
|||
});
|
||||
|
||||
describe('#read', function () {
|
||||
it('uses jquery to get the width and height of the element', function () {
|
||||
var stubw = sinon.spy($.fn, 'width');
|
||||
var stubh = sinon.spy($.fn, 'height');
|
||||
it('gets the proper dimensions for the element', function () {
|
||||
var dimensions = checker.read();
|
||||
var windowWidth = window.innerWidth;
|
||||
|
||||
checker.read();
|
||||
|
||||
expect(stubw).to.have.property('callCount', 1);
|
||||
expect(stubw.getCall(0)).to.have.property('thisValue', checker.$el);
|
||||
|
||||
expect(stubh).to.have.property('callCount', 1);
|
||||
expect(stubh.getCall(0)).to.have.property('thisValue', checker.$el);
|
||||
expect(dimensions.w).to.equal(windowWidth);
|
||||
expect(dimensions.h).to.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -203,4 +198,4 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue