Skip to content

Commit

Permalink
chore: use named exports in playground source & tests
Browse files Browse the repository at this point in the history
Closes #918
  • Loading branch information
Skaiir committed Jan 11, 2024
1 parent d514901 commit 0f043bd
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/form-js-playground/src/Playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { PlaygroundRoot } from './components/PlaygroundRoot';
/**
* @param {FormPlaygroundOptions} options
*/
export default function Playground(options) {
export function Playground(options) {

const {
container: parent,
Expand Down
5 changes: 2 additions & 3 deletions packages/form-js-playground/src/components/JSONEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { EditorState, Compartment } from '@codemirror/state';
import { lintGutter, linter } from '@codemirror/lint';
import { json, jsonParseLinter } from '@codemirror/lang-json';
import { indentWithTab } from '@codemirror/commands';

import autocompletion from './autocompletion/index';
import { autocompletionExtension } from './autocompletion/index';
import { variablesFacet } from './autocompletion/VariablesFacet';

import {
Expand Down Expand Up @@ -70,7 +69,7 @@ export function JSONEditor(options = {}) {
placeholderLinterExtension,
lintGutter(),
autocompletionConf.of(variablesFacet.of(variables)),
autocompletion(),
autocompletionExtension(),
keymap.of([ indentWithTab ]),
editorPlaceholder ? placeholder(editorPlaceholder) : [],
...extensions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { autocompletion } from '@codemirror/autocomplete';
import { variablesFacet } from './VariablesFacet';

import { syntaxTree } from '@codemirror/language';

import { variablesFacet } from './VariablesFacet';

export default function() {
export function autocompletionExtension() {
return [
autocompletion({
override: [
Expand Down
2 changes: 1 addition & 1 deletion packages/form-js-playground/src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as Playground } from './Playground';
export { Playground } from './Playground';
2 changes: 1 addition & 1 deletion packages/form-js-playground/test/custom/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function Step(props) {
}


export default {
export const CustomPropertiesProviderModule = {
__init__: [ 'customPropertiesProvider' ],
customPropertiesProvider: [ 'type', CustomPropertiesProvider ]
};
Expand Down
3 changes: 1 addition & 2 deletions packages/form-js-playground/test/custom/viewer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import {
Errors,
FormContext,
Expand Down Expand Up @@ -93,7 +92,7 @@ class CustomFormFields {
}
}

export default {
export const CustomFormFieldsModule = {
__init__: [ 'customFormFields' ],
customFormFields: [ 'type', CustomFormFields ]
};
Expand Down
8 changes: 4 additions & 4 deletions packages/form-js-playground/test/spec/Playground.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import otherSchema from './other-form.json';
import rowsSchema from './rows-form.json';
import customSchema from './custom.json';

import customViewerModule from '../custom/viewer';
import customEditorModule from '../custom/editor';
import { CustomFormFieldsModule } from '../custom/viewer';
import { CustomPropertiesProviderModule } from '../custom/editor';
import customStyles from '../custom/styles.css';

import {
Expand Down Expand Up @@ -152,10 +152,10 @@ describe('playground', function() {
schema: customSchema,
data,
additionalModules: [
customViewerModule
CustomFormFieldsModule
],
editorAdditionalModules: [
customEditorModule
CustomPropertiesProviderModule
]
});

Expand Down

0 comments on commit 0f043bd

Please sign in to comment.