Skip to content

Commit

Permalink
Math.ceil the height value passed to setDeviceMetricsOverride (#174)
Browse files Browse the repository at this point in the history
* Math.ceil the height passed to setDeviceMetricsOverride

* Add a test case for non-integer viewport

Add reference images for Non-Integer Viewport

* Fix loki logo URL in visual tests (#175)
  • Loading branch information
pawelk authored and oblador committed Oct 2, 2019
1 parent 112765d commit dd8e289
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions examples/react/src/NonIntViewport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';

const NonIntViewport = ({ children }) => (
<div style={{
width :'100%',
paddingTop : '17%',
backgroundColor : '#00f'
}}>
{ children }
</div>
);

export default NonIntViewport;
8 changes: 8 additions & 0 deletions examples/react/src/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import MediaAwareComponent from '../MediaAwareComponent';
import StackedElements from '../StackedElements';
import StackedInvisibleElements from '../StackedInvisibleElements';
import LongElement from '../LongElement';
import NonIntViewport from '../NonIntViewport';

storiesOf('Welcome', module).lokiSkip('to Storybook', () => (
<Welcome showApp={linkTo('Button')} />
Expand Down Expand Up @@ -53,3 +54,10 @@ storiesOf('Multiple elements', module)
.add('Invisible elements', () => <StackedInvisibleElements />);

storiesOf('Long Element', module).add('default', () => <LongElement />);

storiesOf('Non-Int Viewport', module)
.add('default', () => (
<NonIntViewport>
<LongElement />
</NonIntViewport>
));
2 changes: 1 addition & 1 deletion src/targets/chrome/create-chrome-target.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function createChromeTarget(
resetDeviceMetrics = true;
await Emulation.setDeviceMetricsOverride(
Object.assign({}, deviceMetrics, {
height: position.y + position.height,
height: Math.ceil(position.y + position.height),
})
);
}
Expand Down

0 comments on commit dd8e289

Please sign in to comment.