test: ignore some jest-only code (#103)

This commit is contained in:
Nolan Lawson 2020-12-26 18:45:16 -08:00 committed by GitHub
parent 545fcb3b64
commit e0c7245d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -254,9 +254,11 @@ $: {
// eslint-disable-next-line no-unused-vars
function calculateEmojiGridWidth (node) {
return calculateWidth(node, width => {
/* istanbul ignore next */
const newNumColumns = process.env.NODE_ENV === 'test'
? DEFAULT_NUM_COLUMNS
: parseInt(getComputedStyle(rootElement).getPropertyValue('--num-columns'), 10)
/* istanbul ignore next */
const parentWidth = process.env.NODE_ENV === 'test' // jsdom throws an error here occasionally
? 1
: node.parentElement.getBoundingClientRect().width