Skip to content

Commit

Permalink
test(editor): remove jsx snapshot (#9463)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saul-Mirone committed Dec 31, 2024
1 parent 6c33eaa commit 36c1b10
Show file tree
Hide file tree
Showing 57 changed files with 2,743 additions and 1,656 deletions.
62 changes: 0 additions & 62 deletions blocksuite/framework/store/src/__tests__/collection.unit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -865,68 +865,6 @@ describe('getBlock', () => {
});
});

// Inline snapshot is not supported under describe.parallel config
describe('collection.exportJSX works', () => {
it('collection matches snapshot', () => {
const options = createTestOptions();
const collection = new DocCollection(options);
collection.meta.initialize();
const doc = collection.createDoc({ id: 'doc:home' });

doc.addBlock('affine:page', { title: new doc.Text('hello') });

expect(collection.exportJSX()).toMatchInlineSnapshot(`
<affine:page
prop:count={0}
prop:items={[]}
prop:style={{}}
prop:title="hello"
/>
`);
});

it('empty collection matches snapshot', () => {
const options = createTestOptions();
const collection = new DocCollection(options);
collection.meta.initialize();
collection.createDoc({ id: 'doc:home' });

expect(collection.exportJSX()).toMatchInlineSnapshot('null');
});

it('collection with multiple blocks children matches snapshot', () => {
const options = createTestOptions();
const collection = new DocCollection(options);
collection.meta.initialize();
const doc = collection.createDoc({ id: 'doc:home' });
doc.load(() => {
const rootId = doc.addBlock('affine:page', {
title: new doc.Text(),
});
const noteId = doc.addBlock('affine:note', {}, rootId);
doc.addBlock('affine:paragraph', {}, noteId);
doc.addBlock('affine:paragraph', {}, noteId);
});

expect(collection.exportJSX()).toMatchInlineSnapshot(/* xml */ `
<affine:page
prop:count={0}
prop:items={[]}
prop:style={{}}
>
<affine:note>
<affine:paragraph
prop:type="text"
/>
<affine:paragraph
prop:type="text"
/>
</affine:note>
</affine:page>
`);
});
});

describe('flags', () => {
it('update flags', () => {
const options = createTestOptions();
Expand Down
133 changes: 0 additions & 133 deletions blocksuite/framework/store/src/__tests__/jsx.unit.spec.ts

This file was deleted.

2 changes: 0 additions & 2 deletions blocksuite/framework/store/src/store/addon/index.ts

This file was deleted.

19 changes: 0 additions & 19 deletions blocksuite/framework/store/src/store/addon/shared.ts

This file was deleted.

38 changes: 0 additions & 38 deletions blocksuite/framework/store/src/store/addon/test.ts

This file was deleted.

7 changes: 0 additions & 7 deletions blocksuite/framework/store/src/store/addon/type.ts

This file was deleted.

7 changes: 1 addition & 6 deletions blocksuite/framework/store/src/store/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
BlockSuiteDoc,
type RawAwarenessState,
} from '../yjs/index.js';
import { DocCollectionAddonType, test } from './addon/index.js';
import { BlockCollection, type GetDocOptions } from './doc/block-collection.js';
import type { Doc, Query } from './doc/index.js';
import type { IdGeneratorType } from './id.js';
Expand Down Expand Up @@ -73,10 +72,7 @@ export interface StackItem {
meta: Map<'cursor-location' | 'selection-state', unknown>;
}

// oxlint-disable-next-line
// @ts-ignore FIXME: typecheck error
@test
export class DocCollection extends DocCollectionAddonType {
export class DocCollection {
static Y = Y;

protected readonly _schema: Schema;
Expand Down Expand Up @@ -142,7 +138,6 @@ export class DocCollection extends DocCollectionAddonType {
},
logger = new NoopLogger(),
}: DocCollectionOptions) {
super();
this._schema = schema;

this.id = id || '';
Expand Down
68 changes: 0 additions & 68 deletions blocksuite/framework/store/src/utils/formatter.ts

This file was deleted.

Loading

0 comments on commit 36c1b10

Please sign in to comment.