Skip to content

Commit

Permalink
Fix workspace creation
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelDeMartin committed Mar 2, 2024
1 parent c16932d commit dc93766
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
31 changes: 31 additions & 0 deletions cypress/e2e/cloud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,37 @@ describe('Cloud', () => {
});
});

it('Syncs new workspaces and lists', () => {
// Arrange
cy.ariaInput('Login url').type(`${webId()}{enter}`);
cy.solidLogin();
cy.ariaInput('Task name').type('Sync updates{enter}');
cy.dontSee('Loading...');

cy.intercept('PUT', podUrl('/work/')).as('createWorkContainer');
cy.intercept('PATCH', podUrl('/work/.meta')).as('createWorkContainerMeta');
cy.intercept('PUT', podUrl('/work/learning/')).as('createLearningContainer');
cy.intercept('PATCH', podUrl('/work/learning/.meta')).as('createLearningContainerMeta');

// Act
cy.ariaLabel('Select workspace').within(() => {
cy.get('button').click();
});
cy.press('Add new', 'li');
cy.ariaInput('Workspace name').type('Work{enter}');
cy.waitSync();

cy.press('Add new');
cy.ariaInput('List name').type('Learning{enter}');
cy.waitSync();

// Assert
cy.get('@createWorkContainer.all').should('have.length', 1);
cy.get('@createWorkContainerMeta.all').should('have.length', 1);
cy.get('@createLearningContainer.all').should('have.length', 1);
cy.get('@createLearningContainerMeta.all').should('have.length', 1);
});

it('Migrates simple local data', () => {
// Arrange
cy.intercept('PUT', podUrl('/main/')).as('createContainer');
Expand Down
9 changes: 3 additions & 6 deletions src/pages/workspace/WorkspaceSidebarHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
</template>

<script setup lang="ts">
import { Cloud } from '@aerogel/plugin-offline-first';
import { computed } from 'vue';
import { UI, translate } from '@aerogel/core';
import type { ArrayItem } from '@noeldemartin/utils';
import type { RefValue } from '@aerogel/plugin-soukai';
import CloudStatusModal from '@/components/modals/CloudStatusModal.vue';
import TasksList from '@/models/TasksList';
import Workspace from '@/models/Workspace';
import Workspaces from '@/services/Workspaces';
Expand Down Expand Up @@ -64,12 +64,9 @@ async function createWorkspace(): Promise<void> {
return;
}
const list = await TasksList.create({ name: 'Inbox' });
const workspace = await Workspace.create({
name,
listUrls: [list.url],
});
const workspace = await Workspace.create({ name });
await workspace.open();
await Cloud.syncIfOnline(workspace);
}
</script>

0 comments on commit dc93766

Please sign in to comment.