* merging ide-redesign/components/file-tree into features/file-tree * moving ide-redesign/contexts/settings-modal-context to features/settings/contexts * use-collapsible-file-tree.tsx → features/file-tree/hooks * use-focus-on-setting.tsx → features/settings/hooks * use-project-notification-preferences.ts → features/settings/hooks * use-rail-overflow.tsx→ features/ide-react/hooks * deleting use-switch-enable-new-editor-state.ts * use-toolbar-menu-editor-commands.tsx → features/source-editor/hooks * npm run extract-translations * modifying the test to target correct buttons and removing a test for old component * adding a test back and modifying it * changing the test GitOrigin-RevId: baa1e9a992c88b84313eea82161354d4958cf1ef
59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
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'
|
|
|
|
describe('<FileTreeToolbar/>', function () {
|
|
it('without selected files', function () {
|
|
cy.mount(
|
|
<EditorProviders rootDocId="">
|
|
<FileTreeProvider>
|
|
<FileTreeToolbar />
|
|
</FileTreeProvider>
|
|
</EditorProviders>
|
|
)
|
|
|
|
cy.findAllByRole('button', { name: 'New file' })
|
|
cy.findAllByRole('button', { name: 'New folder' })
|
|
cy.findAllByRole('button', { name: 'Upload' })
|
|
cy.findAllByRole('button', { name: 'Rename' }).should('not.exist')
|
|
cy.findAllByRole('button', { name: 'Delete' }).should('not.exist')
|
|
})
|
|
|
|
it('read-only', function () {
|
|
cy.mount(
|
|
<EditorProviders permissionsLevel="readOnly">
|
|
<FileTreeProvider>
|
|
<FileTreeToolbar />
|
|
</FileTreeProvider>
|
|
</EditorProviders>
|
|
)
|
|
|
|
cy.findAllByRole('button').should('have.length', 1)
|
|
})
|
|
|
|
it('with one selected file', function () {
|
|
const rootFolder = [
|
|
{
|
|
_id: 'root-folder-id',
|
|
name: 'rootFolder',
|
|
docs: [{ _id: '456def', name: 'main.tex' }],
|
|
folders: [],
|
|
fileRefs: [],
|
|
},
|
|
]
|
|
|
|
cy.mount(
|
|
<EditorProviders rootDocId="456def" rootFolder={rootFolder as any}>
|
|
<FileTreeProvider>
|
|
<FileTreeToolbar />
|
|
</FileTreeProvider>
|
|
</EditorProviders>
|
|
)
|
|
|
|
cy.findAllByRole('button', { name: 'New file' })
|
|
cy.findAllByRole('button', { name: 'New folder' })
|
|
cy.findAllByRole('button', { name: 'Upload' })
|
|
cy.findAllByRole('button', { name: 'Close' })
|
|
})
|
|
})
|