/
string-renderer.spec.ts
28 lines (24 loc) · 1.04 KB
/
string-renderer.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/// <reference path="../../../references.ts"/>
describe('String renderer', () => {
// load all necessary modules and templates
beforeEach(module('jsonforms.form'));
beforeEach(module('jsonforms.renderers.controls.boolean'));
beforeEach(module('components/form/form.html'));
beforeEach(module('components/renderers/controls/control.html'));
it("should support read-only flag", inject(($rootScope, $compile) => {
let scope = $rootScope.$new();
scope.schema = {
"properties": {
"name": {
"type": "string",
}
}
};
scope.uiSchema = { "type": "Control", "readOnly": true, "scope": { "$ref": "#/properties/name" } };
scope.data = { "vegetarian": true };
let el = $compile('<jsonforms schema="schema" ui-schema="uiSchema" data="data"/>')(scope);
scope.$digest();
let input = angular.element(el[0].getElementsByClassName('jsf-control-string'));
expect(input.attr("readonly")).toBeDefined();
}));
});