mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Merge pull request #36141 from overleaf/oa-teardown-editor-upgrade-button-relocation
[web] Teardown `editor-upgrade-button-relocation` GitOrigin-RevId: b6c53eef240ac2386907e0d0a942c674cfc9133b
This commit is contained in:
@@ -515,7 +515,6 @@ const _ProjectController = {
|
||||
'command-palette',
|
||||
'overleaf-library',
|
||||
'focus-mode',
|
||||
'editor-upgrade-button-relocation',
|
||||
'markdown-visual',
|
||||
'ai-disabled-collaborators',
|
||||
'group-link-sharing',
|
||||
|
||||
@@ -31,9 +31,6 @@ export const Toolbar = () => {
|
||||
const { cobranding, isRestrictedTokenMember } = useEditorContext()
|
||||
const { permissionsLevel } = useIdeReactContext()
|
||||
const showUpgradePrompt = getMeta('ol-showUpgradePrompt')
|
||||
const upgradeButtonRelocation = useFeatureFlag(
|
||||
'editor-upgrade-button-relocation'
|
||||
)
|
||||
const improvedFlakyConnections = useFeatureFlag(
|
||||
'intermittent-connection-improvements'
|
||||
)
|
||||
@@ -131,7 +128,7 @@ export const Toolbar = () => {
|
||||
<div className="ide-redesign-toolbar-menu">
|
||||
<ToolbarLogos cobranding={cobranding} />
|
||||
<ToolbarMenuBar />
|
||||
{showUpgradePrompt && upgradeButtonRelocation && <UpgradeButton />}
|
||||
{showUpgradePrompt && <UpgradeButton />}
|
||||
</div>
|
||||
<ToolbarProjectTitle />
|
||||
<div className="ide-redesign-toolbar-actions-wrapper">
|
||||
@@ -147,7 +144,6 @@ export const Toolbar = () => {
|
||||
<SubmitProjectButton cobranding={cobranding} />
|
||||
)}
|
||||
<ShareProjectButton />
|
||||
{showUpgradePrompt && !upgradeButtonRelocation && <UpgradeButton />}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -251,6 +251,42 @@ describe('<Toolbar />', function () {
|
||||
// TODO: Test all the dynamic items
|
||||
})
|
||||
|
||||
describe('upgrade button', function () {
|
||||
afterEach(function () {
|
||||
cy.window().then(win => {
|
||||
win.metaAttributesCache.delete('ol-showUpgradePrompt')
|
||||
})
|
||||
})
|
||||
|
||||
const mountWithUpgradePrompt = (showUpgradePrompt: boolean) => {
|
||||
cy.window().then(win => {
|
||||
win.metaAttributesCache.set('ol-showUpgradePrompt', showUpgradePrompt)
|
||||
})
|
||||
cy.mount(
|
||||
<EditorProviders>
|
||||
<Toolbar />
|
||||
</EditorProviders>
|
||||
)
|
||||
}
|
||||
|
||||
it('shows the upgrade button in the menu bar when the upgrade prompt is enabled', function () {
|
||||
mountWithUpgradePrompt(true)
|
||||
// Shown in the left-hand menu bar (the shipped position)...
|
||||
cy.get('.ide-redesign-toolbar-menu').within(() => {
|
||||
cy.findByRole('link', { name: 'Upgrade' }).should('be.visible')
|
||||
})
|
||||
// ...and no longer in the top-right actions area
|
||||
cy.get('.ide-redesign-toolbar-actions').within(() => {
|
||||
cy.findByRole('link', { name: 'Upgrade' }).should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
it('does not show the upgrade button when the upgrade prompt is disabled', function () {
|
||||
mountWithUpgradePrompt(false)
|
||||
cy.findByRole('link', { name: 'Upgrade' }).should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('offline gating', function () {
|
||||
const offlineIndicatorText = 'You’re offline'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user