-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
format and dateinput support added in ui-kendo
- Loading branch information
Showing
29 changed files
with
268 additions
and
109 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
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
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
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
50 changes: 50 additions & 0 deletions
50
modules/core/src/model/editor/dynamic-editor.model.spec.ts
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,50 @@ | ||
import { | ||
DYNAMIC_FORM_CONTROL_TYPE_EDITOR, | ||
DynamicEditorModel | ||
} from "./dynamic-editor.model"; | ||
|
||
describe("DynamicEditorModel test suite", () => { | ||
|
||
let model: DynamicEditorModel, | ||
config: any = { | ||
id: "editor", | ||
validators: {required: null, minLength: 5} | ||
}; | ||
|
||
beforeEach(() => model = new DynamicEditorModel(config)); | ||
|
||
it("should initialize correctly", () => { | ||
|
||
expect(model.disabled).toBe(false); | ||
expect(model.errorMessages).toBeNull(); | ||
expect(model.hasErrorMessages).toBe(false); | ||
expect(model.id).toEqual(config.id); | ||
expect(model.label).toBeNull(); | ||
expect(model.name).toEqual(model.id); | ||
expect(model.type).toEqual(DYNAMIC_FORM_CONTROL_TYPE_EDITOR); | ||
expect(model.value).toBeNull(); | ||
}); | ||
|
||
it("should throw when no model id is specified", () => { | ||
|
||
expect(() => new DynamicEditorModel({})) | ||
.toThrow(new Error("string id must be specified for DynamicFormControlModel")); | ||
}); | ||
|
||
it("should set disabled property correctly", () => { | ||
|
||
model.disabledUpdates.next(true); | ||
|
||
expect(model.disabled).toBe(true); | ||
}); | ||
|
||
it("should serialize correctly", () => { | ||
|
||
let json = JSON.parse(JSON.stringify(model)); | ||
|
||
expect(json.id).toEqual(model.id); | ||
expect(Object.keys(json.validators).length).toBe(Object.keys(model.validators).length); | ||
expect(json.value).toBe(model.value); | ||
expect(json.type).toEqual(DYNAMIC_FORM_CONTROL_TYPE_EDITOR); | ||
}); | ||
}); |
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,18 @@ | ||
import { ClsConfig } from "../dynamic-form-control.model"; | ||
import { DynamicInputControlModel, DynamicInputControlModelConfig } from "../dynamic-input-control.model"; | ||
import { serializable } from "../../decorator/serializable.decorator"; | ||
|
||
export const DYNAMIC_FORM_CONTROL_TYPE_EDITOR = "EDITOR"; | ||
|
||
export interface DynamicEditorModelConfig extends DynamicInputControlModelConfig<string> { | ||
} | ||
|
||
export class DynamicEditorModel extends DynamicInputControlModel<string> { | ||
|
||
@serializable() readonly type: string = DYNAMIC_FORM_CONTROL_TYPE_EDITOR; | ||
|
||
constructor(config: DynamicEditorModelConfig, cls?: ClsConfig) { | ||
|
||
super(config, cls); | ||
} | ||
} |
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
Oops, something went wrong.