mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2025-04-06 21:40:23 +08:00
fix test
This commit is contained in:
parent
a6c76f0d24
commit
56b22d81e8
@ -1,6 +1,6 @@
|
||||
import { AppModel } from '../../src/AppModel/AppModel';
|
||||
import { ComponentId, ComponentType } from '../../src/AppModel/IAppModel';
|
||||
import { registry } from '../sevices';
|
||||
import { registry } from '../services';
|
||||
import { AppSchema, DuplicatedIdSchema } from './mock';
|
||||
|
||||
describe('AppModel test', () => {
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
import { AppSchema, EventHandlerMockSchema } from './mock';
|
||||
import { produce } from 'immer';
|
||||
import { get } from 'lodash-es';
|
||||
import { registry } from '../sevices';
|
||||
import { registry } from '../services';
|
||||
|
||||
describe('ComponentModel test', () => {
|
||||
it('compute component property', () => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { AppModel } from '../../src/AppModel/AppModel';
|
||||
import { ComponentId } from '../../src/AppModel/IAppModel';
|
||||
import { registry } from '../sevices';
|
||||
import { registry } from '../services';
|
||||
import { AppSchema } from './mock';
|
||||
import { genOperation } from '../../src/operations';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { OrphanComponentSchema } from './mock';
|
||||
import { SchemaValidator } from '../../src/validator';
|
||||
import { registry } from '../sevices';
|
||||
import { registry } from '../services';
|
||||
|
||||
const schemaValidator = new SchemaValidator(registry);
|
||||
|
||||
|
@ -4,7 +4,7 @@ import {
|
||||
ComponentWrongPropertyExpressionSchema,
|
||||
} from './mock';
|
||||
import { SchemaValidator } from '../../src/validator';
|
||||
import { registry } from '../sevices';
|
||||
import { registry } from '../services';
|
||||
|
||||
const schemaValidator = new SchemaValidator(registry);
|
||||
|
||||
|
@ -4,7 +4,7 @@ import {
|
||||
EventTraitTraitMethodSchema,
|
||||
} from './mock';
|
||||
import { SchemaValidator } from '../../src/validator';
|
||||
import { registry } from '../sevices';
|
||||
import { registry } from '../services';
|
||||
|
||||
const schemaValidator = new SchemaValidator(registry);
|
||||
|
||||
|
@ -50,12 +50,15 @@ export function initSunmaoUIEditor(props: SunmaoUIEditorProps = {}) {
|
||||
|
||||
const didMount = () => {
|
||||
eventBus.send('HTMLElementsUpdated');
|
||||
if (props.runtimeProps?.hooks?.didMount) props.runtimeProps.hooks.didMount();
|
||||
};
|
||||
const didUpdate = () => {
|
||||
eventBus.send('HTMLElementsUpdated');
|
||||
if (props.runtimeProps?.hooks?.didUpdate) props.runtimeProps.hooks.didUpdate();
|
||||
};
|
||||
const didDomUpdate = () => {
|
||||
eventBus.send('HTMLElementsUpdated');
|
||||
if (props.runtimeProps?.hooks?.didDomUpdate) props.runtimeProps.hooks.didDomUpdate();
|
||||
};
|
||||
|
||||
const ui = initSunmaoUI({
|
||||
|
@ -29,8 +29,7 @@
|
||||
const rootEl = document.querySelector('#root');
|
||||
const render = example => {
|
||||
ReactDOM.unmountComponentAtNode(rootEl);
|
||||
const { App, registry } = initSunmaoUI();
|
||||
registry.installLib(sunmaoChakraUILib);
|
||||
const { App, registry } = initSunmaoUI({libs: [sunmaoChakraUILib]});
|
||||
const { app, modules = [] } = example.value;
|
||||
modules.forEach(m => {
|
||||
registry.registerModule(m);
|
||||
|
@ -36,6 +36,10 @@ export function initSunmaoUI(props: SunmaoUIRuntimeProps = {}) {
|
||||
);
|
||||
const hooks = props.hooks;
|
||||
|
||||
props.libs?.forEach(lib => {
|
||||
registry.installLib(lib);
|
||||
});
|
||||
|
||||
return {
|
||||
App: genApp(
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user