diff --git a/components/renderers/controls/array/array-renderer.spec.ts b/components/renderers/controls/array/array-renderer.spec.ts index e57343b77..68580e137 100644 --- a/components/renderers/controls/array/array-renderer.spec.ts +++ b/components/renderers/controls/array/array-renderer.spec.ts @@ -57,4 +57,34 @@ describe('Array renderer', () => { scope.$digest(); expect(angular.element(el[0].getElementsByClassName('jsf-group').length)[0]).toBe(1); })); + + it("should be capable of rendering an array as read-only", inject(($rootScope, $compile) => { + let scope = $rootScope.$new(); + scope.schema = { + "properties": { + "comments": { + "type": "array", + "items": { + "properties": { + "msg": {"type": "string"} + } + } + } + } + }; + scope.uiSchema = { + "type": "Control", + "scope": { "$ref": "#/properties/comments" }, + "readOnly": true, + "options": { + "submit": true + } + }; + scope.data = {}; + let el = $compile('')(scope); + scope.$digest(); + let fieldSet = angular.element(el[0].getElementsByTagName("fieldset")); + console.log(fieldSet); + expect(fieldSet.attr("disabled")).toBeDefined(); + })); }); \ No newline at end of file diff --git a/components/renderers/controls/array/array-renderer.ts b/components/renderers/controls/array/array-renderer.ts index 59c404542..7db06b1b6 100644 --- a/components/renderers/controls/array/array-renderer.ts +++ b/components/renderers/controls/array/array-renderer.ts @@ -102,7 +102,7 @@ class ArrayRenderer implements JSONForms.IRenderer { let template = ` -
+
${label}