-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(json): add json field * json field improvements (#131) * fix: adjustments in json field * fix: adjust test --------- Co-authored-by: Marc Güell Segarra <[email protected]>
- Loading branch information
1 parent
c329f0f
commit 45b01fa
Showing
6 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import CodeEditor from "./CodeEditor"; | ||
|
||
class JSONField extends CodeEditor { | ||
_lang = "json"; | ||
} | ||
|
||
export default JSONField; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import WidgetFactory from "../WidgetFactory"; | ||
import JSONField from "../JSONField"; | ||
import { it, expect, describe } from "vitest"; | ||
|
||
describe("A Json field", () => { | ||
it("should be created by the widget factory", () => { | ||
const widgetFactory = new WidgetFactory(); | ||
const props = { | ||
name: "json_field", | ||
}; | ||
const widget = widgetFactory.createWidget("json", props); | ||
expect(widget).toBeInstanceOf(JSONField); | ||
}); | ||
it("should have lang set to json as default", () => { | ||
const widgetFactory = new WidgetFactory(); | ||
const props = { | ||
name: "json_field", | ||
}; | ||
const widget = widgetFactory.createWidget("json", props); | ||
expect(widget.lang).toBe("json"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters