Merge pull request #19347 from overleaf/td-bs5-cypress-css

Move CSS loading in Cypress to individual test spec files

GitOrigin-RevId: 92bb5167cfa81b0bd54acc724efb23b397421ccb
This commit is contained in:
Tim Down 2024-07-24 14:40:24 +01:00 committed by Copybot
parent d7357b4d62
commit e60885aa88
81 changed files with 91 additions and 6 deletions

View file

@ -1,5 +1,4 @@
import 'cypress-plugin-tab'
import '../../frontend/stylesheets/main-style.less'
import { resetMeta } from './ct/window' // needs to be before i18n
import '../../frontend/js/i18n'
import './shared/commands'

View file

@ -40,7 +40,7 @@ function Email({ userEmailData }: EmailProps) {
</div>
)}
{hasBadges && (
<div className={classnames({ small: !isBootstrap5 })}>
<div className={classnames({ small: !isBootstrap5() })}>
{isPrimary && (
<>
<OLBadge bg="info">Primary</OLBadge>{' '}

View file

@ -97,7 +97,7 @@ function ReconfirmationInfo({ userEmailData }: ReconfirmationInfoProps) {
return (
<OLRow>
<OLCol lg={12}>
{isBootstrap5 ? (
{isBootstrap5() ? (
<OLNotification
type="info"
content={

View file

@ -9,7 +9,7 @@ function BootstrapVersionSwitcher({
bs3,
bs5,
}: BootstrapVersionSwitcherProps): React.ReactElement {
return <>{isBootstrap5 ? bs5 : bs3}</>
return <>{isBootstrap5() ? bs5 : bs3}</>
}
export default BootstrapVersionSwitcher

View file

@ -1,9 +1,11 @@
import getMeta from '@/utils/meta'
export const isBootstrap5 = getMeta('ol-bootstrapVersion') === 5
// The reason this is a function to ensure that meta tag is read before any
// isBootstrap5 check is performed
export const isBootstrap5 = () => getMeta('ol-bootstrapVersion') === 5
export const bsVersion = ({ bs5, bs3 }: { bs5?: string; bs3?: string }) => {
return isBootstrap5 ? bs5 : bs3
return isBootstrap5() ? bs5 : bs3
}
// get all `aria-*` and `data-*` attributes

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import EditorLeftMenu from '../../../../frontend/js/features/editor-left-menu/components/editor-left-menu'
import {
AllowedImageName,

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import { EditorProviders } from '../../helpers/editor-providers'
import DetachCompileButtonWrapper from '../../../../frontend/js/features/pdf-preview/components/detach-compile-button-wrapper'
import { mockScope } from './scope'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import { EditorProviders } from '../../helpers/editor-providers'
import PdfJsViewer from '../../../../frontend/js/features/pdf-preview/components/pdf-js-viewer'
import { mockScope } from './scope'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import { EditorProviders } from '../../helpers/editor-providers'
import PdfLogsEntries from '../../../../frontend/js/features/pdf-preview/components/pdf-logs-entries'
import { detachChannel, testDetachChannel } from '../../helpers/detach-channel'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import PdfPreviewDetachedRoot from '../../../../frontend/js/features/pdf-preview/components/pdf-preview-detached-root'
import { detachChannel, testDetachChannel } from '../../helpers/detach-channel'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import { EditorProviders } from '../../helpers/editor-providers'
import PdfPreviewHybridToolbar from '../../../../frontend/js/features/pdf-preview/components/pdf-preview-hybrid-toolbar'
import { testDetachChannel } from '../../helpers/detach-channel'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import localStorage from '../../../../frontend/js/infrastructure/local-storage'
import PdfPreview from '../../../../frontend/js/features/pdf-preview/components/pdf-preview'
import { EditorProviders } from '../../helpers/editor-providers'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import PdfSynctexControls from '../../../../frontend/js/features/pdf-preview/components/pdf-synctex-controls'
import { cloneDeep } from 'lodash'
import { useDetachCompileContext as useCompileContext } from '../../../../frontend/js/shared/context/detach-compile-context'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import GroupInvitationNotification from '@/features/project-list/components/notifications/groups/group-invitation/group-invitation'
import { NotificationGroupInvitation } from '../../../../../types/project/dashboard/notification'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import { Modal } from 'react-bootstrap'
import AccessibleModal from '../../../../frontend/js/shared/components/accessible-modal'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import BetaBadge from '../../../../frontend/js/shared/components/beta-badge'
describe('beta badge', function () {

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import { useCallback, FormEvent } from 'react'
import { Button, Form, FormControl } from 'react-bootstrap'
import {

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import SplitMenu from '../../../../frontend/js/shared/components/split-menu'
describe('SplitMenu', function () {

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import SplitTestBadge from '../../../../frontend/js/shared/components/split-test-badge'
import { EditorProviders } from '../../helpers/editor-providers'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import StartFreeTrialButton from '../../../../frontend/js/shared/components/start-free-trial-button'
import getMeta from '@/utils/meta'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import Tooltip from '../../../../frontend/js/shared/components/tooltip'
describe('<Tooltip />', function () {

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import TokenAccessPage from '@/features/token-access/components/token-access-root'
import { location } from '@/shared/components/location'

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import FileTreeCreateNameInput from '../../../../../../frontend/js/features/file-tree/components/file-tree-create/file-tree-create-name-input'
import FileTreeCreateNameProvider from '../../../../../../frontend/js/features/file-tree/contexts/file-tree-create-name'

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import { useEffect } from 'react'
import FileTreeModalCreateFile from '../../../../../../frontend/js/features/file-tree/components/modals/file-tree-modal-create-file'
import { useFileTreeActionable } from '../../../../../../frontend/js/features/file-tree/contexts/file-tree-actionable'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import FileTreeDoc from '../../../../../frontend/js/features/file-tree/components/file-tree-doc'
import { EditorProviders } from '../../../helpers/editor-providers'
import { FileTreeProvider } from '../helpers/file-tree-provider'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import FileTreeFolderList from '../../../../../frontend/js/features/file-tree/components/file-tree-folder-list'
import { EditorProviders } from '../../../helpers/editor-providers'
import { FileTreeProvider } from '../helpers/file-tree-provider'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import FileTreeFolder from '../../../../../frontend/js/features/file-tree/components/file-tree-folder'
import { EditorProviders } from '../../../helpers/editor-providers'
import { FileTreeProvider } from '../helpers/file-tree-provider'

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import FileTreeitemInner from '../../../../../../frontend/js/features/file-tree/components/file-tree-item/file-tree-item-inner'
import FileTreeContextMenu from '../../../../../../frontend/js/features/file-tree/components/file-tree-context-menu'
import { EditorProviders } from '../../../../helpers/editor-providers'

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import FileTreeItemName from '../../../../../../frontend/js/features/file-tree/components/file-tree-item/file-tree-item-name'
import { EditorProviders } from '../../../../helpers/editor-providers'
import { FileTreeProvider } from '../../helpers/file-tree-provider'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import FileTreeRoot from '../../../../../frontend/js/features/file-tree/components/file-tree-root'
import { EditorProviders } from '../../../helpers/editor-providers'
import { SocketIOMock } from '@/ide/connection/SocketIoShim'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import FileTreeToolbar from '../../../../../frontend/js/features/file-tree/components/file-tree-toolbar'
import { EditorProviders } from '../../../helpers/editor-providers'
import { FileTreeProvider } from '../helpers/file-tree-provider'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import FileTreeRoot from '../../../../../frontend/js/features/file-tree/components/file-tree-root'
import { EditorProviders } from '../../../helpers/editor-providers'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import FileTreeRoot from '../../../../../frontend/js/features/file-tree/components/file-tree-root'
import { EditorProviders } from '../../../helpers/editor-providers'
import { SocketIOMock } from '@/ide/connection/SocketIoShim'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import FileTreeRoot from '../../../../../frontend/js/features/file-tree/components/file-tree-root'
import { EditorProviders } from '../../../helpers/editor-providers'
import { SocketIOMock } from '@/ide/connection/SocketIoShim'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import FileTreeRoot from '../../../../../frontend/js/features/file-tree/components/file-tree-root'
import { EditorProviders } from '../../../helpers/editor-providers'
import { SocketIOMock } from '@/ide/connection/SocketIoShim'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import GroupManagers from '@/features/group-management/components/group-managers'
const JOHN_DOE = {

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import GroupMembers from '@/features/group-management/components/group-members'
import { GroupMembersProvider } from '@/features/group-management/context/group-members-context'
import { User } from '../../../../../types/group-management/user'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import InstitutionManagers from '@/features/group-management/components/institution-managers'
const JOHN_DOE = {

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import GroupMembers from '@/features/group-management/components/group-members'
import { GroupMembersProvider } from '@/features/group-management/context/group-members-context'
import { User } from '../../../../../types/group-management/user'

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import type { PropsWithChildren } from 'react'
import sinon from 'sinon'
import DropdownButton from '@/features/group-management/components/members-table/dropdown-button'

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import ManagedUserStatus from '@/features/group-management/components/members-table/managed-user-status'
import { User } from '../../../../../../types/group-management/user'

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import sinon from 'sinon'
import MemberRow from '@/features/group-management/components/members-table/member-row'
import { GroupMembersProvider } from '@/features/group-management/context/group-members-context'

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import MembersList from '@/features/group-management/components/members-table/members-list'
import { GroupMembersProvider } from '@/features/group-management/context/group-members-context'
import { User } from '../../../../../../types/group-management/user'

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import OffboardManagedUserModal from '@/features/group-management/components/members-table/offboard-managed-user-modal'
import sinon from 'sinon'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import PublisherManagers from '@/features/group-management/components/publisher-managers'
const JOHN_DOE = {

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { useState } from 'react'
import ToggleSwitch from '../../../../../frontend/js/features/history/components/change-list/toggle-switch'
import ChangeList from '../../../../../frontend/js/features/history/components/change-list/change-list'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import DocumentDiffViewer from '../../../../../frontend/js/features/history/components/diff-view/document-diff-viewer'
import { Highlight } from '../../../../../frontend/js/features/history/services/types/doc'
import { FC } from 'react'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import Toolbar from '../../../../../frontend/js/features/history/components/diff-view/toolbar/toolbar'
import { HistoryProvider } from '../../../../../frontend/js/features/history/context/history-context'
import { HistoryContextValue } from '../../../../../frontend/js/features/history/context/types/history-context-value'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { EditorProviders } from '../../../helpers/editor-providers'
import SwitchToEditorButton from '@/features/pdf-preview/components/switch-to-editor-button'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import SwitchToPDFButton from '@/features/source-editor/components/switch-to-pdf-button'
import { EditorProviders } from '../../../helpers/editor-providers'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import OutlineItem from '../../../../../frontend/js/features/outline/components/outline-item'
describe('<OutlineItem />', function () {

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import OutlineList from '../../../../../frontend/js/features/outline/components/outline-list'
describe('<OutlineList />', function () {

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import OutlinePane from '@/features/outline/components/outline-pane'
import { EditorProviders, PROJECT_ID } from '../../../helpers/editor-providers'
import { useState } from 'react'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import OutlineRoot from '../../../../../frontend/js/features/outline/components/outline-root'
describe('<OutlineRoot />', function () {

View file

@ -1,3 +1,4 @@
import '../../../../helpers/bootstrap-3'
import UploadProjectModal from '../../../../../../frontend/js/features/project-list/components/new-project-button/upload-project-modal'
describe('<UploadProjectModal />', function () {

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import CodeMirrorEditor from '../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { EditorProviders } from '../../helpers/editor-providers'
import { mockScope } from '../source-editor/helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { Folder } from '../../../../../types/folder'
import { docId, mockDocContent } from '../helpers/mock-doc'
import { mockScope } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { mockScope } from '../helpers/mock-scope'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodeMirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { mockScope } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { EditorProviders } from '../../../helpers/editor-providers'
import { mockScope, rootFolderId } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { mockScope } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { mockScope } from '../helpers/mock-scope'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodeMirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { mockScope } from '../helpers/mock-scope'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodeMirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'

View file

@ -1,5 +1,6 @@
// Needed since eslint gets confused by mocha-each
/* eslint-disable mocha/prefer-arrow-callback */
import '../../../helpers/bootstrap-3'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { mockScope } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { mockScope } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { mockScope } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { mockScope } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { mockScope } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { mockScope } from '../helpers/mock-scope'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { mockScope } from '../helpers/mock-scope'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import { mockScope } from '../helpers/mock-scope'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'

View file

@ -1,5 +1,6 @@
// Needed since eslint gets confused by mocha-each
/* eslint-disable mocha/prefer-arrow-callback */
import '../../../helpers/bootstrap-3'
import { FC } from 'react'
import { EditorProviders } from '../../../helpers/editor-providers'
import CodemirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'

View file

@ -1,3 +1,4 @@
import '../../../helpers/bootstrap-3'
import CodeMirrorEditor from '../../../../../frontend/js/features/source-editor/components/codemirror-editor'
import { EditorProviders } from '../../../helpers/editor-providers'
import { mockScope } from '../helpers/mock-scope'

View file

@ -0,0 +1,5 @@
import '../../../frontend/stylesheets/main-style.less'
beforeEach(function () {
window.metaAttributesCache.set('ol-bootstrapVersion', 3)
})

View file

@ -0,0 +1,5 @@
import '../../../frontend/stylesheets/bootstrap-5/main-style.scss'
beforeEach(function () {
window.metaAttributesCache.set('ol-bootstrapVersion', 5)
})

View file

@ -1,3 +1,4 @@
import '../helpers/bootstrap-3'
import { Trans, useTranslation } from 'react-i18next'
describe('i18n', function () {

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import { FC } from 'react'
import useDetachAction from '../../../../frontend/js/shared/hooks/use-detach-action'
import { detachChannel, testDetachChannel } from '../../helpers/detach-channel'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import useDetachLayout from '../../../../frontend/js/shared/hooks/use-detach-layout'
import { detachChannel, testDetachChannel } from '../../helpers/detach-channel'
import { EditorProviders } from '../../helpers/editor-providers'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import { FC } from 'react'
import useDetachState from '../../../../frontend/js/shared/hooks/use-detach-state'
import { EditorProviders } from '../../helpers/editor-providers'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import { useRecaptcha } from '@/shared/hooks/use-recaptcha'
import * as ReactGoogleRecaptcha from 'react-google-recaptcha'

View file

@ -1,3 +1,4 @@
import '../../helpers/bootstrap-3'
import {
usePersistedResize,
useResize,