fix: First auto-save unfocuses document (#1046)

* fix: Autosave unfocuses document

* Revert unneeded change

* test: le fix

* fix: Handle offline state
fix: Untitled documents appear with empty titles

* fix: Draft bubble roundness (yes, it doesnt belong here but see it, fix it)
This commit is contained in:
Tom Moor
2019-09-22 17:09:11 -07:00
committed by GitHub
parent b1a1d24f9c
commit 4164fc178c
10 changed files with 104 additions and 113 deletions

View File

@ -1039,22 +1039,6 @@ describe('#documents.create', async () => {
expect(newDocument.collection.id).toBe(collection.id);
});
it('should fallback to a default title', async () => {
const { user, collection } = await seed();
const res = await server.post('/api/documents.create', {
body: {
token: user.getJwtToken(),
collectionId: collection.id,
title: ' ',
text: ' ',
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.title).toBe('Untitled document');
expect(body.data.text).toBe('# Untitled document');
});
it('should not allow very long titles', async () => {
const { user, collection } = await seed();
const res = await server.post('/api/documents.create', {
@ -1183,25 +1167,6 @@ describe('#documents.update', async () => {
expect(revisionRecords).toBe(prevRevisionRecords);
});
it('should fallback to a default title', async () => {
const { user, document } = await seed();
const res = await server.post('/api/documents.update', {
body: {
token: user.getJwtToken(),
id: document.id,
title: ' ',
text: ' ',
lastRevision: document.revision,
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.title).toBe('Untitled document');
expect(body.data.text).toBe('# Untitled document');
});
it('should fail if document lastRevision does not match', async () => {
const { user, document } = await seed();