test: fix @schlechtenburg core tests
This commit is contained in:
parent
aa2cbbde5b
commit
9ff091bd39
37
package-lock.json
generated
37
package-lock.json
generated
|
@ -14,7 +14,7 @@
|
|||
"packages/image",
|
||||
"packages/paragraph",
|
||||
"packages/layout",
|
||||
"packages/standalone"
|
||||
"packages/rich-text"
|
||||
],
|
||||
"dependencies": {
|
||||
"lodash-es": "^4.17.21"
|
||||
|
@ -751,7 +751,6 @@
|
|||
"version": "7.25.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz",
|
||||
"integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.14.0"
|
||||
},
|
||||
|
@ -2995,8 +2994,8 @@
|
|||
"resolved": "packages/paragraph",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@schlechtenburg/standalone": {
|
||||
"resolved": "packages/standalone",
|
||||
"node_modules/@schlechtenburg/rich-text": {
|
||||
"resolved": "packages/rich-text",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@sentry/core": {
|
||||
|
@ -4579,6 +4578,19 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@wordpress/escape-html": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-3.9.0.tgz",
|
||||
"integrity": "sha512-+/SnVUXzzr+0pgfAqK3pocGveSDS3SHrgJ1BTgV7DA1l6y9mbjnqKgFQkNW/nzca92ZuYg2vjLcq1dqDGz4v1Q==",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.12.0",
|
||||
"npm": ">=8.19.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@yarnpkg/lockfile": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz",
|
||||
|
@ -11619,8 +11631,7 @@
|
|||
"node_modules/regenerator-runtime": {
|
||||
"version": "0.14.1",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
|
||||
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
|
||||
},
|
||||
"node_modules/regex": {
|
||||
"version": "4.3.2",
|
||||
|
@ -13919,9 +13930,23 @@
|
|||
"vue": "^3.2.31"
|
||||
}
|
||||
},
|
||||
"packages/rich-text": {
|
||||
"name": "@schlechtenburg/rich-text",
|
||||
"version": "0.0.0",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@wordpress/escape-html": "^3.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vuedx/typecheck": "^0.6.3",
|
||||
"@vuedx/typescript-plugin-vue": "^0.6.3",
|
||||
"vue": "^3.2.31"
|
||||
}
|
||||
},
|
||||
"packages/standalone": {
|
||||
"name": "@schlechtenburg/standalone",
|
||||
"version": "0.0.0",
|
||||
"extraneous": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@schlechtenburg/core": "^0.0.0"
|
||||
|
|
|
@ -35,6 +35,6 @@
|
|||
"packages/image",
|
||||
"packages/paragraph",
|
||||
"packages/layout",
|
||||
"packages/standalone"
|
||||
"packages/rich-text"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
const heading = require('..');
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { mount } from '@vue/test-utils';
|
||||
import SbHeadingEdit from '../lib/edit';
|
||||
import SbHeadingView from '../lib/view';
|
||||
|
||||
describe('@schlechtenburg/heading', () => {
|
||||
it('needs tests');
|
||||
it('edit should render', () => {
|
||||
const edit = mount(SbHeadingEdit);
|
||||
expect(edit.find('p').element).toBeTruthy();
|
||||
expect(edit.find('div.sb-toolbar').element).toBeTruthy();
|
||||
});
|
||||
it('view should render', () => {
|
||||
const edit = mount(SbHeadingView);
|
||||
expect(edit.find('h1').element).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
const image = require('..');
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { mount } from '@vue/test-utils';
|
||||
import SbImageEdit from '../lib/edit';
|
||||
import SbImageView from '../lib/view';
|
||||
|
||||
describe('@schlechtenburg/image', () => {
|
||||
it('needs tests');
|
||||
it('edit should render', () => {
|
||||
const edit = mount(SbImageEdit);
|
||||
expect(edit.find('figure').element).toBeTruthy();
|
||||
expect(edit.find('div.sb-toolbar').element).toBeTruthy();
|
||||
});
|
||||
it('view should render', () => {
|
||||
const edit = mount(SbImageView);
|
||||
expect(edit.find('img').element).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
const layout = require('..');
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { mount } from '@vue/test-utils';
|
||||
import SbLayoutEdit from '../lib/edit';
|
||||
import SbLayoutView from '../lib/view';
|
||||
|
||||
describe('@schlechtenburg/layout', () => {
|
||||
it('needs tests');
|
||||
it('edit should render', () => {
|
||||
const edit = mount(SbLayoutEdit);
|
||||
expect(edit.find('div.sb-layout').element).toBeTruthy();
|
||||
expect(edit.find('div.sb-toolbar').element).toBeTruthy();
|
||||
});
|
||||
it('view should render', () => {
|
||||
const edit = mount(SbLayoutView);
|
||||
expect(edit.find('div.sb-layout').element).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { withSetup } from '../../../test';
|
||||
import SbParagraph from '../lib';
|
||||
import SbParagraphEdit from '../lib/edit';
|
||||
import SbParagraphView from '../lib/view';
|
||||
|
||||
describe('@schlechtenburg/paragraph', () => {
|
||||
it('edit should render', () => {
|
||||
const edit = mount(SbParagraph.edit);
|
||||
expect(edit.find('p')).toContain();
|
||||
edit.element
|
||||
const edit = mount(SbParagraphEdit);
|
||||
expect(edit.find('p').element).toBeTruthy();
|
||||
expect(edit.find('div.sb-toolbar').element).toBeTruthy();
|
||||
});
|
||||
it('view should render', () => {
|
||||
mount(SbParagraph.view);
|
||||
const edit = mount(SbParagraphView);
|
||||
expect(edit.find('p').element).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
"license": "GPL-3.0-or-later",
|
||||
"main": "lib/index.ts",
|
||||
"directories": {
|
||||
"doc": "docs",
|
||||
"lib": "lib"
|
||||
},
|
||||
"files": [
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const core = require('..');
|
||||
|
||||
describe('@schlechtenburg/core', () => {
|
||||
it('needs tests');
|
||||
});
|
17
packages/standalone/__tests__/standalone.test.ts
Normal file
17
packages/standalone/__tests__/standalone.test.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
import { startSchlechtenburg, SbMode } from '../lib';
|
||||
import exampleData from '../../../docs/example-data';
|
||||
|
||||
describe('@schlechtenburg/standalone', () => {
|
||||
it('edit should render', async () => {
|
||||
const wrapper = document.createElement('div');
|
||||
const sb = await startSchlechtenburg(wrapper, {
|
||||
availableBlocks: [],
|
||||
block: exampleData,
|
||||
eventUpdate: () => {},
|
||||
mode: SbMode.View,
|
||||
});
|
||||
expect(sb.getMode()).toBe(SbMode.View);
|
||||
expect(sb.getBlock()).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -1 +1,2 @@
|
|||
export * from '@schlechtenburg/core';
|
||||
export * from './main';
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { defineConfig } from 'vitest/config'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
plugins: [vue(), vueJsx()],
|
||||
test: {
|
||||
browser: {
|
||||
enabled: true,
|
||||
|
|
Loading…
Reference in a new issue