Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(value): fix boolean value issue #557

Merged
merged 6 commits into from Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -47,11 +47,11 @@
(click)="toggleComment()">
<mat-icon>comment</mat-icon>
</button>
<span [matTooltip]="(canDelete ? 'delete' : 'This value cannot be deleted because at least one value is required')">
<span [matTooltip]="((canDelete && valueTypeOrClass != constants.BooleanValue ) ? 'delete' : 'This value cannot be deleted because at least one value is required')">
<button mat-button
class="delete"
*ngIf="!readOnlyValue && canModify && !editModeActive && projectStatus"
[disabled]="!canDelete"
[disabled]="!canDelete || valueTypeOrClass === constants.BooleanValue"
(click)="openDialog()">
<mat-icon>delete</mat-icon>
</button>
Expand Down
Expand Up @@ -137,11 +137,7 @@ <h3 class="label mat-title">
</div>
<!-- Add button -->
<div *ngIf="addValueIsAllowed(prop) && project?.status">
<!-- boolen value will always be displayed even if value is not defined (value = false) -->
<span *ngIf="prop.propDef.objectType === booleanValueTypeIri">
<app-boolean-value [mode]="'read'" class="boolean-value"></app-boolean-value>
</span>
<button *ngIf="prop.propDef.objectType !== booleanValueTypeIri" mat-icon-button type="button" class="value-action create"
<button mat-icon-button type="button" class="value-action create"
(click)="showAddValueForm(prop, $event)"
title="Add a new value">
<mat-icon>add_box</mat-icon>
Expand Down
Expand Up @@ -388,8 +388,7 @@ describe('PropertiesComponent', () => {

let addButtons = propertyViewComponentDe.queryAll(By.css('button.create'));

// current amount of buttons should equal 17
// because the boolean property shouldn't have an add button if it has a value
// current amount of buttons should equal 18
kilchenmann marked this conversation as resolved.
Show resolved Hide resolved
// standoff links value and has incoming link value are system props and cannot be added: -2
expect(addButtons.length).toEqual(17);

Expand All @@ -399,14 +398,9 @@ describe('PropertiesComponent', () => {
testHostFixture.detectChanges();

// now the boolean property should have an add button
// so the amount of add buttons on the page should increase by 1
// standoff links value and has incoming link value are system props and cannot be added: -2
addButtons = propertyViewComponentDe.queryAll(By.css('button.create'));
expect(addButtons.length).toEqual(17);

// in case of boolean value, we do not display the add button, but the boolean value itself
const booleanValue = propertyViewComponentDe.queryAll(By.css('.boolean-value'));
expect(booleanValue.length).toEqual(1);
expect(addButtons.length).toEqual(18);

});

Expand Down
Expand Up @@ -122,7 +122,7 @@ export class SpecifyPropertyValueComponent implements OnChanges, OnDestroy {
break;

case Constants.BooleanValue:
this.comparisonOperators = [new Equals()];
this.comparisonOperators = [new Equals(), new Exists()];
break;

case Constants.UriValue:
Expand Down