• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eclipsesource / jsonforms / 5679494411

pending completion
5679494411

push

github

lucas-koehler
angular-material: Fix unfocused description display for number renderer

The template had a bug closing the ngIf that checks whether the description
is shown too early. This lead to a DOMException and the description to never be shown.

Fix #2166

110 of 179 branches covered (61.45%)

305 of 362 relevant lines covered (84.25%)

13.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.35
/packages/angular-material/src/other/object.renderer.ts
1
/*
2
  The MIT License
3
  
4
  Copyright (c) 2017-2019 EclipseSource Munich
5
  https://github.com/eclipsesource/jsonforms
6
  
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
8
  of this software and associated documentation files (the "Software"), to deal
9
  in the Software without restriction, including without limitation the rights
10
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
  copies of the Software, and to permit persons to whom the Software is
12
  furnished to do so, subject to the following conditions:
13
  
14
  The above copyright notice and this permission notice shall be included in
15
  all copies or substantial portions of the Software.
16
  
17
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
  THE SOFTWARE.
24
*/
25
import isEmpty from 'lodash/isEmpty';
26
import startCase from 'lodash/startCase';
27
import { ChangeDetectionStrategy, Component } from '@angular/core';
28
import {
29
  JsonFormsAngularService,
30
  JsonFormsControlWithDetail,
31
} from '@jsonforms/angular';
32
import {
33
  ControlWithDetailProps,
34
  findUISchema,
35
  GroupLayout,
36
  isObjectControl,
37
  RankedTester,
38
  rankWith,
39
  setReadonly,
40
  UISchemaElement,
41
} from '@jsonforms/core';
42

43
@Component({
44
  selector: 'ObjectRenderer',
45
  template: `
46
    <mat-card>
47
      <jsonforms-outlet
48
        [uischema]="detailUiSchema"
49
        [schema]="scopedSchema"
50
        [path]="propsPath"
51
      >
52
      </jsonforms-outlet>
53
    </mat-card>
54
  `,
55
  changeDetection: ChangeDetectionStrategy.OnPush,
56
})
57
export class ObjectControlRenderer extends JsonFormsControlWithDetail {
1✔
58
  detailUiSchema: UISchemaElement;
59
  constructor(jsonformsService: JsonFormsAngularService) {
60
    super(jsonformsService);
5!
61
  }
62
  mapAdditionalProps(props: ControlWithDetailProps) {
1✔
63
    this.detailUiSchema = findUISchema(
8✔
64
      props.uischemas,
65
      props.schema,
66
      props.uischema.scope,
67
      props.path,
68
      'Group',
69
      props.uischema,
70
      props.rootSchema
71
    );
72
    if (isEmpty(props.path)) {
8✔
73
      this.detailUiSchema.type = 'VerticalLayout';
2✔
74
    } else {
75
      (this.detailUiSchema as GroupLayout).label = startCase(props.path);
6✔
76
    }
77
    if (!this.isEnabled()) {
8!
78
      setReadonly(this.detailUiSchema);
×
79
    }
80
  }
81
}
1✔
82
export const ObjectControlRendererTester: RankedTester = rankWith(
1✔
83
  2,
84
  isObjectControl
85
);
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc