Merge pull request #3495 from overleaf/ae-prettier-2

Upgrade Prettier to v2

GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
Alf Eaton
2021-04-15 02:05:22 +00:00
committed by Copybot
parent 930d7ba028
commit 1ebc8a79cb
582 changed files with 20382 additions and 20374 deletions
@@ -4,7 +4,7 @@ import { screen, render } from '@testing-library/react'
import PreviewDownloadButton from '../../../../../frontend/js/features/preview/components/preview-download-button'
describe('<PreviewDownloadButton />', function() {
describe('<PreviewDownloadButton />', function () {
const projectId = 'projectId123'
const pdfDownloadUrl = `/download/project/${projectId}/build/17523aaafdf-1ad9063af140f004/output/output.pdf?compileGroup=priority&popupDownload=true`
@@ -26,17 +26,14 @@ describe('<PreviewDownloadButton />', function() {
)
}
it('should disable the button and dropdown toggle when compiling', function() {
it('should disable the button and dropdown toggle when compiling', function () {
const isCompiling = true
const outputFiles = undefined
renderPreviewDownloadButton(isCompiling, outputFiles)
expect(
screen
.getByText('Download PDF')
.closest('a')
.getAttribute('disabled')
screen.getByText('Download PDF').closest('a').getAttribute('disabled')
).to.exist
const buttons = screen.getAllByRole('button')
expect(buttons.length).to.equal(1) // the dropdown toggle
@@ -45,35 +42,26 @@ describe('<PreviewDownloadButton />', function() {
'Toggle output files list'
)
})
it('should disable the PDF button when there is no PDF', function() {
it('should disable the PDF button when there is no PDF', function () {
const isCompiling = false
const outputFiles = []
renderPreviewDownloadButton(isCompiling, outputFiles)
expect(
screen
.getByText('Download PDF')
.closest('a')
.getAttribute('disabled')
screen.getByText('Download PDF').closest('a').getAttribute('disabled')
).to.exist
})
it('should enable the PDF button when there is a main PDF', function() {
it('should enable the PDF button when there is a main PDF', function () {
const isCompiling = false
const outputFiles = []
renderPreviewDownloadButton(isCompiling, outputFiles, pdfDownloadUrl)
expect(
screen
.getByText('Download PDF')
.closest('a')
.getAttribute('href')
screen.getByText('Download PDF').closest('a').getAttribute('href')
).to.equal(pdfDownloadUrl)
expect(
screen
.getByText('Download PDF')
.closest('a')
.getAttribute('disabled')
screen.getByText('Download PDF').closest('a').getAttribute('disabled')
).to.not.exist
})
it('should enable the dropdown when not compiling', function() {
it('should enable the dropdown when not compiling', function () {
const isCompiling = false
const outputFiles = []
renderPreviewDownloadButton(isCompiling, outputFiles, pdfDownloadUrl)
@@ -82,13 +70,13 @@ describe('<PreviewDownloadButton />', function() {
expect(buttons[0].getAttribute('disabled')).to.not.exist
})
it('should show the button text when prop showText=true', function() {
it('should show the button text when prop showText=true', function () {
const isCompiling = false
const showText = true
renderPreviewDownloadButton(isCompiling, [], pdfDownloadUrl, showText)
expect(screen.getByText('Download PDF').getAttribute('style')).to.be.null
})
it('should not show the button text when prop showText=false', function() {
it('should not show the button text when prop showText=false', function () {
const isCompiling = false
const showText = false
renderPreviewDownloadButton(isCompiling, [], pdfDownloadUrl, showText)
@@ -6,7 +6,7 @@ import PreviewDownloadFileList, {
topFileTypes
} from '../../../../../frontend/js/features/preview/components/preview-download-file-list'
describe('<PreviewDownloadFileList />', function() {
describe('<PreviewDownloadFileList />', function () {
const projectId = 'projectId123'
function makeFile(fileName, main) {
@@ -18,7 +18,7 @@ describe('<PreviewDownloadFileList />', function() {
}
}
it('should list all output files and group them', function() {
it('should list all output files and group them', function () {
const outputFiles = [
makeFile('output.ind'),
makeFile('output.log'),
@@ -55,15 +55,12 @@ describe('<PreviewDownloadFileList />', function() {
.map(file => file.type)
const topMenuItems = menuItems.slice(0, outputTopFileTypes.length)
topMenuItems.forEach(item => {
const fileType = item.textContent
.split('.')
.pop()
.replace(' file', '')
const fileType = item.textContent.split('.').pop().replace(' file', '')
expect(topFileTypes.includes(fileType)).to.be.true
})
})
it('should list all files when there are duplicate types', function() {
it('should list all files when there are duplicate types', function () {
const pdfFile = makeFile('output.pdf', true)
const bblFile = makeFile('output.bbl')
const outputFiles = [Object.assign({}, { ...bblFile }), bblFile, pdfFile]
@@ -76,7 +73,7 @@ describe('<PreviewDownloadFileList />', function() {
expect(bblMenuItems.length).to.equal(2)
})
it('should list the non-main PDF in the dropdown', function() {
it('should list the non-main PDF in the dropdown', function () {
const pdfFile = makeFile('output.pdf', true)
const pdfAltFile = makeFile('alt.pdf')
const outputFiles = [pdfFile, pdfAltFile]
@@ -84,8 +81,8 @@ describe('<PreviewDownloadFileList />', function() {
screen.getAllByRole('menuitem', { name: 'alt.pdf' })
})
describe('list divider and header', function() {
it('should display when there are top files and other files', function() {
describe('list divider and header', function () {
it('should display when there are top files and other files', function () {
const outputFiles = [
makeFile('output.bbl'),
makeFile('output.ind'),
@@ -99,7 +96,7 @@ describe('<PreviewDownloadFileList />', function() {
screen.getByRole('separator')
})
it('should not display when there are top files and no other files', function() {
it('should not display when there are top files and no other files', function () {
const outputFiles = [
makeFile('output.bbl'),
makeFile('output.ind'),
@@ -112,7 +109,7 @@ describe('<PreviewDownloadFileList />', function() {
expect(screen.queryByRole('separator')).to.not.exist
})
it('should not display when there are other files and no top files', function() {
it('should not display when there are other files and no top files', function () {
const outputFiles = [makeFile('output.log')]
render(<PreviewDownloadFileList fileList={outputFiles} />)
@@ -5,10 +5,10 @@ import { screen, render, fireEvent } from '@testing-library/react'
import PreviewLogsPaneEntry from '../../../../../frontend/js/features/preview/components/preview-logs-pane-entry.js'
describe('<PreviewLogsPaneEntry />', function() {
describe('<PreviewLogsPaneEntry />', function () {
const level = 'error'
it('renders a configurable aria-label', function() {
it('renders a configurable aria-label', function () {
const sampleAriaLabel = 'lorem ipsum dolor sit amet'
render(
<PreviewLogsPaneEntry entryAriaLabel={sampleAriaLabel} level={level} />
@@ -16,17 +16,17 @@ describe('<PreviewLogsPaneEntry />', function() {
screen.getByLabelText(sampleAriaLabel)
})
describe('logs pane source location link', function() {
describe('logs pane source location link', function () {
const file = 'foo.tex'
const line = 42
const column = 21
const onSourceLocationClick = sinon.stub()
afterEach(function() {
afterEach(function () {
onSourceLocationClick.reset()
})
it('renders both file and line', function() {
it('renders both file and line', function () {
render(
<PreviewLogsPaneEntry sourceLocation={{ file, line }} level={level} />
)
@@ -35,14 +35,14 @@ describe('<PreviewLogsPaneEntry />', function() {
})
})
it('renders only file when line information is not available', function() {
it('renders only file when line information is not available', function () {
render(<PreviewLogsPaneEntry sourceLocation={{ file }} level={level} />)
screen.getByRole('button', {
name: `Navigate to log position in source code: ${file}`
})
})
it('does not render when file information is not available', function() {
it('does not render when file information is not available', function () {
render(<PreviewLogsPaneEntry level={level} />)
expect(
screen.queryByRole('button', {
@@ -51,7 +51,7 @@ describe('<PreviewLogsPaneEntry />', function() {
).to.not.exist
})
it('calls the callback with file, line and column on click', function() {
it('calls the callback with file, line and column on click', function () {
render(
<PreviewLogsPaneEntry
sourceLocation={{ file, line, column }}
@@ -73,7 +73,7 @@ describe('<PreviewLogsPaneEntry />', function() {
})
})
describe('logs pane entry raw contents', function() {
describe('logs pane entry raw contents', function () {
const rawContent = 'foo bar latex error stuff baz'
// JSDom doesn't compute layout/sizing, so we need to simulate sizing for the elements
@@ -88,7 +88,7 @@ describe('<PreviewLogsPaneEntry />', function() {
'offsetWidth'
)
beforeEach(function() {
beforeEach(function () {
Object.defineProperty(HTMLElement.prototype, 'scrollHeight', {
configurable: true,
value: 500
@@ -99,7 +99,7 @@ describe('<PreviewLogsPaneEntry />', function() {
})
})
afterEach(function() {
afterEach(function () {
Object.defineProperty(
HTMLElement.prototype,
'scrollHeight',
@@ -112,7 +112,7 @@ describe('<PreviewLogsPaneEntry />', function() {
)
})
it('renders collapsed contents by default', function() {
it('renders collapsed contents by default', function () {
render(<PreviewLogsPaneEntry rawContent={rawContent} level={level} />)
screen.getByText(rawContent)
screen.getByRole('button', {
@@ -120,7 +120,7 @@ describe('<PreviewLogsPaneEntry />', function() {
})
})
it('supports expanding contents', function() {
it('supports expanding contents', function () {
render(<PreviewLogsPaneEntry rawContent={rawContent} level={level} />)
screen.getByText(rawContent)
const expandCollapseBtn = screen.getByRole('button', {
@@ -132,19 +132,19 @@ describe('<PreviewLogsPaneEntry />', function() {
})
})
it('should not render at all when there are no log contents', function() {
it('should not render at all when there are no log contents', function () {
const { container } = render(<PreviewLogsPaneEntry level={level} />)
expect(container.querySelector('.log-entry-content')).to.not.exist
})
})
describe('formatted content', function() {
describe('formatted content', function () {
const rawContent = 'foo bar latex error stuff baz'
const formattedContentText = 'foo bar baz'
const formattedContent = <>{formattedContentText}</>
const infoURL = 'www.overleaf.com/learn/latex'
it('renders the hint', function() {
it('renders the hint', function () {
render(
<PreviewLogsPaneEntry
rawContent={rawContent}
@@ -156,7 +156,7 @@ describe('<PreviewLogsPaneEntry />', function() {
screen.getByText(formattedContentText)
})
it('renders the link to learn more', function() {
it('renders the link to learn more', function () {
render(
<PreviewLogsPaneEntry
rawContent={rawContent}
@@ -168,7 +168,7 @@ describe('<PreviewLogsPaneEntry />', function() {
screen.getByRole('link', { name: 'Learn more' })
})
it('does not render the link when it is not available', function() {
it('does not render the link when it is not available', function () {
render(
<PreviewLogsPaneEntry
rawContent={rawContent}
@@ -6,7 +6,7 @@ import { renderWithEditorContext } from '../../../helpers/render-with-context'
const { expect } = require('chai')
describe('<PreviewLogsPane />', function() {
describe('<PreviewLogsPane />', function () {
const sampleError1 = {
content: 'error 1 content',
file: 'main.tex',
@@ -59,8 +59,8 @@ entering extended mode
const noOp = () => {}
const onLogEntryLocationClick = sinon.stub()
describe('with logs', function() {
beforeEach(function() {
describe('with logs', function () {
beforeEach(function () {
renderWithEditorContext(
<PreviewLogsPane
logEntries={logEntries}
@@ -70,7 +70,7 @@ entering extended mode
/>
)
})
it('renders all log entries with appropriate labels', function() {
it('renders all log entries with appropriate labels', function () {
const errorEntries = screen.getAllByLabelText(
`Log entry with level: error`
)
@@ -85,11 +85,11 @@ entering extended mode
expect(typesettingEntries).to.have.lengthOf(typesetting.length)
})
it('renders the raw log', function() {
it('renders the raw log', function () {
screen.getByLabelText('Raw logs from the LaTeX compiler')
})
it('renders a link to location button for every error and warning log entry', function() {
it('renders a link to location button for every error and warning log entry', function () {
logEntries.all.forEach((entry, index) => {
const linkToSourceButton = screen.getByRole('button', {
name: `Navigate to log position in source code: ${entry.file}, ${entry.line}`
@@ -106,7 +106,7 @@ entering extended mode
).to.be.true
})
})
it(' does not render a link to location button for the raw log entry', function() {
it(' does not render a link to location button for the raw log entry', function () {
const rawLogEntry = screen.getByLabelText(
'Raw logs from the LaTeX compiler'
)
@@ -114,7 +114,7 @@ entering extended mode
})
})
describe('with validation issues', function() {
describe('with validation issues', function () {
const sampleValidationIssues = {
sizeCheck: {
resources: [
@@ -125,7 +125,7 @@ entering extended mode
mainFile: true
}
it('renders a validation entry for known issues', function() {
it('renders a validation entry for known issues', function () {
renderWithEditorContext(
<PreviewLogsPane
validationIssues={sampleValidationIssues}
@@ -141,7 +141,7 @@ entering extended mode
)
})
it('ignores unknown issues', function() {
it('ignores unknown issues', function () {
renderWithEditorContext(
<PreviewLogsPane
validationIssues={{ unknownIssue: true }}
@@ -156,14 +156,14 @@ entering extended mode
})
})
describe('with compilation errors', function() {
describe('with compilation errors', function () {
const sampleErrors = {
clsiMaintenance: true,
tooRecentlyCompiled: true,
compileTerminated: true
}
it('renders an error entry for known errors', function() {
it('renders an error entry for known errors', function () {
renderWithEditorContext(
<PreviewLogsPane
errors={sampleErrors}
@@ -177,7 +177,7 @@ entering extended mode
expect(errorEntries).to.have.lengthOf(Object.keys(sampleErrors).length)
})
it('ignores unknown errors', function() {
it('ignores unknown errors', function () {
renderWithEditorContext(
<PreviewLogsPane
errors={{ unknownIssue: true }}
@@ -192,8 +192,8 @@ entering extended mode
})
})
describe('with failing code check', function() {
beforeEach(function() {
describe('with failing code check', function () {
beforeEach(function () {
renderWithEditorContext(
<PreviewLogsPane
logEntries={logEntries}
@@ -204,7 +204,7 @@ entering extended mode
/>
)
})
it('renders a code check failed entry', function() {
it('renders a code check failed entry', function () {
screen.getByText(
'Your code has errors that need to be fixed before the auto-compile can run'
)
@@ -4,7 +4,7 @@ import { screen, render } from '@testing-library/react'
import PreviewLogsToggleButton from '../../../../../frontend/js/features/preview/components/preview-logs-toggle-button'
describe('<PreviewLogsToggleButton />', function() {
describe('<PreviewLogsToggleButton />', function () {
function renderPreviewLogsToggleButton(
logsState,
onToggleLogs,
@@ -25,27 +25,27 @@ describe('<PreviewLogsToggleButton />', function() {
)
}
describe('basic toggle functionality', function() {
describe('basic toggle functionality', function () {
const logsState = {
nErrors: 0,
nWarnings: 0
}
const onToggleLogs = () => {}
it('should render a view logs button when previewing the PDF', function() {
it('should render a view logs button when previewing the PDF', function () {
const showLogs = false
renderPreviewLogsToggleButton(logsState, onToggleLogs, showLogs)
screen.getByText('View logs')
})
it('should render a view PDF button when viewing logs', function() {
it('should render a view PDF button when viewing logs', function () {
const showLogs = true
renderPreviewLogsToggleButton(logsState, onToggleLogs, showLogs)
screen.getByText('View PDF')
})
})
describe('compile status indicator', function() {
describe('compile status indicator', function () {
const showLogs = false
const onToggleLogs = () => {}
it('should render a view logs button by default', function() {
it('should render a view logs button by default', function () {
const logsState = {
nErrors: 0,
nWarnings: 0
@@ -54,7 +54,7 @@ describe('<PreviewLogsToggleButton />', function() {
screen.getByText('View logs')
})
it('should render the code check failed notice', function() {
it('should render the code check failed notice', function () {
const logsState = {
nErrors: 1,
nWarnings: 0
@@ -69,7 +69,7 @@ describe('<PreviewLogsToggleButton />', function() {
screen.getByText('Code check failed')
})
it('should render an error status message when there are errors', function() {
it('should render an error status message when there are errors', function () {
const logsState = {
nErrors: 1,
nWarnings: 0
@@ -78,7 +78,7 @@ describe('<PreviewLogsToggleButton />', function() {
screen.getByText(`This project has errors (${logsState.nErrors})`)
})
it('should render an error status message when there are both errors and warnings', function() {
it('should render an error status message when there are both errors and warnings', function () {
const logsState = {
nErrors: 1,
nWarnings: 1
@@ -87,7 +87,7 @@ describe('<PreviewLogsToggleButton />', function() {
screen.getByText(`This project has errors (${logsState.nErrors})`)
})
it('should render a warning status message when there are warnings but no errors', function() {
it('should render a warning status message when there are warnings but no errors', function () {
const logsState = {
nErrors: 0,
nWarnings: 1
@@ -96,7 +96,7 @@ describe('<PreviewLogsToggleButton />', function() {
screen.getByText(`View warnings (${logsState.nWarnings})`)
})
it('should render 99+ errors when there are more than 99 errors', function() {
it('should render 99+ errors when there are more than 99 errors', function () {
const logsState = {
nErrors: 100,
nWarnings: 0
@@ -104,7 +104,7 @@ describe('<PreviewLogsToggleButton />', function() {
renderPreviewLogsToggleButton(logsState, onToggleLogs, showLogs)
screen.getByText('This project has errors (99+)')
})
it('should show the button text when prop showText=true', function() {
it('should show the button text when prop showText=true', function () {
const logsState = {
nErrors: 0,
nWarnings: 0
@@ -113,7 +113,7 @@ describe('<PreviewLogsToggleButton />', function() {
renderPreviewLogsToggleButton(logsState, onToggleLogs, showLogs, showText)
expect(screen.getByText('View logs').getAttribute('style')).to.be.null
})
it('should not show the button text when prop showText=false', function() {
it('should not show the button text when prop showText=false', function () {
const logsState = {
nErrors: 0,
nWarnings: 0
@@ -3,7 +3,7 @@ import { screen, render, fireEvent } from '@testing-library/react'
import PreviewPane from '../../../../../frontend/js/features/preview/components/preview-pane'
const { expect } = require('chai')
describe('<PreviewPane />', function() {
describe('<PreviewPane />', function () {
const sampleError1 = {
content: 'error 1 content',
file: 'main.tex',
@@ -25,8 +25,8 @@ describe('<PreviewPane />', function() {
message: "Reference `idontexist' on page 1 undefined on input line 30."
}
describe('first error pop-up', function() {
it('renders a first error pop-up with the first error', function() {
describe('first error pop-up', function () {
it('renders a first error pop-up with the first error', function () {
const propsAfterCompileWithErrors = getProps(false, {
errors: [sampleError1, sampleError2],
warnings: [sampleWarning]
@@ -38,7 +38,7 @@ describe('<PreviewPane />', function() {
screen.getByText(sampleError1.message)
})
it('does not render a first error pop-up when there are only warnings', function() {
it('does not render a first error pop-up when there are only warnings', function () {
const propsAfterCompileWithWarningsOnly = getProps(false, {
errors: [],
warnings: [sampleWarning]
@@ -51,7 +51,7 @@ describe('<PreviewPane />', function() {
).to.not.exist
})
it('does not render a first error pop-up when a compile is ongoing', function() {
it('does not render a first error pop-up when a compile is ongoing', function () {
const propsWhileCompiling = getProps(true, {
errors: [sampleError1, sampleError2],
warnings: [sampleWarning]
@@ -64,7 +64,7 @@ describe('<PreviewPane />', function() {
).to.not.exist
})
it('does not render a first error pop-up when viewing logs', function() {
it('does not render a first error pop-up when viewing logs', function () {
const propsWithErrorsViewingLogs = getProps(
false,
{
@@ -82,7 +82,7 @@ describe('<PreviewPane />', function() {
).to.not.exist
})
it('does not render a first error pop-up when going back to the PDF view after viewing logs', function() {
it('does not render a first error pop-up when going back to the PDF view after viewing logs', function () {
const nowTimestamp = Date.now()
const propsWithErrorsViewingLogs = getProps(
false,
@@ -113,7 +113,7 @@ describe('<PreviewPane />', function() {
).to.not.exist
})
it('renders a first error pop-up with updated errors after recompiling', function() {
it('renders a first error pop-up with updated errors after recompiling', function () {
const nowTimestamp = Date.now()
const laterTimestamp = Date.now() + 1000
const propsWithErrorsAfterFirstCompile = getProps(
@@ -144,7 +144,7 @@ describe('<PreviewPane />', function() {
screen.getByText(sampleError2.message)
})
it('allows dismissing the first error pop-up', function() {
it('allows dismissing the first error pop-up', function () {
const propsWithErrors = getProps(false, {
errors: [sampleError1, sampleError2],
warnings: [sampleWarning]
@@ -162,7 +162,7 @@ describe('<PreviewPane />', function() {
).to.not.exist
})
it('does not render the first error pop-up with new recompiles after it being dismissed once', function() {
it('does not render the first error pop-up with new recompiles after it being dismissed once', function () {
const nowTimestamp = Date.now()
const laterTimestamp = Date.now() + 1000
const propsWithErrorsForFirstCompile = getProps(
@@ -197,8 +197,8 @@ describe('<PreviewPane />', function() {
})
})
describe('accessible description of the compile result', function() {
it('renders an accessible description with the errors and warnings count', function() {
describe('accessible description of the compile result', function () {
it('renders an accessible description with the errors and warnings count', function () {
const errors = [sampleError1, sampleError2]
const warnings = [sampleWarning]
const propsWithErrorsAndWarnings = getProps(false, {
@@ -212,7 +212,7 @@ describe('<PreviewPane />', function() {
`${warnings.length} warning${warnings.length > 1 ? 's' : ''}`
)
})
it('renders an accessible description for failed compiles with CLSI errors', function() {
it('renders an accessible description for failed compiles with CLSI errors', function () {
const sampleCLSIError = {
clsiMaintenance: true
}
@@ -231,7 +231,7 @@ describe('<PreviewPane />', function() {
screen.getByText('This project did not compile because of an error')
})
it('renders an accessible description for failed compiles with validation issues', function() {
it('renders an accessible description for failed compiles with validation issues', function () {
const sampleValidationIssue = {
clsiMaintenance: true
}
@@ -4,16 +4,16 @@ import { screen, render, fireEvent } from '@testing-library/react'
import PreviewRecompileButton from '../../../../../frontend/js/features/preview/components/preview-recompile-button'
const { expect } = require('chai')
describe('<PreviewRecompileButton />', function() {
describe('<PreviewRecompileButton />', function () {
let onRecompile, onRecompileFromScratch, onStopCompilation
beforeEach(function() {
beforeEach(function () {
onRecompile = sinon.stub().resolves()
onRecompileFromScratch = sinon.stub().resolves()
onStopCompilation = sinon.stub().resolves()
})
it('renders all items', function() {
it('renders all items', function () {
renderPreviewRecompileButton()
const menuItems = screen.getAllByRole('menuitem')
@@ -39,9 +39,9 @@ describe('<PreviewRecompileButton />', function() {
])
})
describe('Recompile from scratch', function() {
describe('click', function() {
it('should call onRecompileFromScratch', async function() {
describe('Recompile from scratch', function () {
describe('click', function () {
it('should call onRecompileFromScratch', async function () {
renderPreviewRecompileButton()
const button = screen.getByRole('menuitem', {
@@ -51,8 +51,8 @@ describe('<PreviewRecompileButton />', function() {
expect(onRecompileFromScratch).to.have.been.calledOnce
})
})
describe('processing', function() {
it('shows processing view and disable menuItem when recompiling', function() {
describe('processing', function () {
it('shows processing view and disable menuItem when recompiling', function () {
renderPreviewRecompileButton({ isCompiling: true })
screen.getByRole('button', { name: 'Compiling…' })
@@ -75,12 +75,12 @@ describe('<PreviewRecompileButton />', function() {
})
})
it('should show the button text when prop showText=true', function() {
it('should show the button text when prop showText=true', function () {
const showText = true
renderPreviewRecompileButton({}, showText)
expect(screen.getByText('Recompile').getAttribute('style')).to.be.null
})
it('should not show the button text when prop showText=false', function() {
it('should not show the button text when prop showText=false', function () {
const showText = false
renderPreviewRecompileButton({}, showText)
expect(screen.getByText('Recompile').getAttribute('style')).to.equal(
@@ -88,8 +88,8 @@ describe('<PreviewRecompileButton />', function() {
)
})
describe('Autocompile feedback', function() {
it('shows animated visual feedback via CSS class when there are uncompiled changes', function() {
describe('Autocompile feedback', function () {
it('shows animated visual feedback via CSS class when there are uncompiled changes', function () {
const { container } = renderPreviewRecompileButton({
autoCompileHasChanges: true,
autoCompileHasLintingError: false
@@ -103,7 +103,7 @@ describe('<PreviewRecompileButton />', function() {
)
).to.be.true
})
it('does not show animated visual feedback via CSS class when there are no uncompiled changes', function() {
it('does not show animated visual feedback via CSS class when there are no uncompiled changes', function () {
const { container } = renderPreviewRecompileButton({
autoCompileHasChanges: false,
autoCompileHasLintingError: false
@@ -4,7 +4,7 @@ import { expect } from 'chai'
import { screen, render, fireEvent } from '@testing-library/react'
import PreviewToolbar from '../../../../../frontend/js/features/preview/components/preview-toolbar'
describe('<PreviewToolbar />', function() {
describe('<PreviewToolbar />', function () {
const onRecompile = sinon.stub()
const onRecompileFromScratch = sinon.stub()
const onRunSyntaxCheckNow = sinon.stub()
@@ -53,14 +53,14 @@ describe('<PreviewToolbar />', function() {
)
}
it('renders the toolbar', function() {
it('renders the toolbar', function () {
renderPreviewToolbar()
screen.getByText('Recompile')
screen.getByText('Download PDF')
screen.getByText('View logs')
})
it('all toolbar items have "toolbar-item" class and text has "toolbar-text"', function() {
it('all toolbar items have "toolbar-item" class and text has "toolbar-text"', function () {
renderPreviewToolbar()
const toolbar = screen.getByTestId('toolbar-preview')
for (const toolbarSection of toolbar.children) {
@@ -77,7 +77,7 @@ describe('<PreviewToolbar />', function() {
}
})
it('renders a full-screen button with a tooltip when when in split-screen mode', function() {
it('renders a full-screen button with a tooltip when when in split-screen mode', function () {
renderPreviewToolbar()
const btn = screen.getByLabelText('Full screen')
fireEvent.click(btn)
@@ -86,7 +86,7 @@ describe('<PreviewToolbar />', function() {
screen.getByRole('tooltip', { name: 'Full screen' })
})
it('renders a split-screen button with a tooltip when when in full-screen mode', function() {
it('renders a split-screen button with a tooltip when when in full-screen mode', function () {
renderPreviewToolbar({}, {}, false, false)
const btn = screen.getByLabelText('Split screen')
fireEvent.click(btn)