-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(ui): display schema attributes * feat(ui): improve attribute layout
- Loading branch information
Showing
14 changed files
with
312 additions
and
36 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
14 changes: 14 additions & 0 deletions
14
springwolf-ui/src/app/components/new/schema/range/range.component.html
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,14 @@ | ||
<!-- SPDX-License-Identifier: Apache-2.0 --> | ||
<span> | ||
<span *ngIf="lowerBound() != undefined && upperBound() == undefined"> | ||
{{ lowerBoundInclusive() ? ">=" : ">" }} {{ lowerBound() }} | ||
</span> | ||
<span *ngIf="lowerBound() == undefined && upperBound() != undefined"> | ||
{{ upperBoundInclusive() ? "<=" : "<" }} {{ upperBound() }} | ||
</span> | ||
<span *ngIf="lowerBound() != undefined && upperBound() != undefined" | ||
>{{ lowerBoundInclusive() ? "[" : "(" }} {{ lowerBound() }} | ||
.. | ||
{{ upperBound() }} {{ upperBoundInclusive() ? "]" : ")" }} | ||
</span> | ||
</span> |
110 changes: 110 additions & 0 deletions
110
springwolf-ui/src/app/components/new/schema/range/range.component.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,110 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
import { RangeNewComponent as RangeComponent } from "./range.component"; | ||
import { render, screen } from "@testing-library/angular"; | ||
|
||
describe("SchemaRangeNewComponent", function () { | ||
it("should create the component", async () => { | ||
await render(RangeComponent, { | ||
componentInputs: { | ||
lowerBound: 0.1, | ||
upperBound: 10, | ||
lowerBoundInclusive: false, | ||
upperBoundInclusive: false, | ||
}, | ||
}); | ||
|
||
expect(screen).toBeTruthy(); | ||
}); | ||
|
||
it("should have `( 0.1 .. 10 )` as value", async () => { | ||
await render(RangeComponent, { | ||
componentInputs: { | ||
lowerBound: 0.1, | ||
upperBound: 10, | ||
lowerBoundInclusive: false, | ||
upperBoundInclusive: false, | ||
}, | ||
}); | ||
|
||
expect(screen.getByText("( 0.1 .. 10 )")).toBeTruthy(); | ||
}); | ||
|
||
it("should have `[ 0.1 .. 10 )` as value", async () => { | ||
await render(RangeComponent, { | ||
componentInputs: { | ||
lowerBound: 0.1, | ||
upperBound: 10, | ||
lowerBoundInclusive: true, | ||
upperBoundInclusive: false, | ||
}, | ||
}); | ||
|
||
expect(screen.getByText("[ 0.1 .. 10 )")).toBeTruthy(); | ||
}); | ||
|
||
it("should have `( 0.1 .. 10 ]` as value", async () => { | ||
await render(RangeComponent, { | ||
componentInputs: { | ||
lowerBound: 0.1, | ||
upperBound: 10, | ||
lowerBoundInclusive: false, | ||
upperBoundInclusive: true, | ||
}, | ||
}); | ||
|
||
expect(screen.getByText("( 0.1 .. 10 ]")).toBeTruthy(); | ||
}); | ||
|
||
it("should have `[ 0.1 .. 10 ]` as value", async () => { | ||
await render(RangeComponent, { | ||
componentInputs: { | ||
lowerBound: 0.1, | ||
upperBound: 10, | ||
}, | ||
}); | ||
|
||
expect(screen.getByText("[ 0.1 .. 10 ]")).toBeTruthy(); | ||
}); | ||
|
||
it("should have `> 0.1` as value", async () => { | ||
await render(RangeComponent, { | ||
componentInputs: { | ||
lowerBound: 0.1, | ||
lowerBoundInclusive: false, | ||
}, | ||
}); | ||
|
||
expect(screen.getByText("> 0.1")).toBeTruthy(); | ||
}); | ||
|
||
it("should have `< 10` as value", async () => { | ||
await render(RangeComponent, { | ||
componentInputs: { | ||
upperBound: 10, | ||
upperBoundInclusive: false, | ||
}, | ||
}); | ||
|
||
expect(screen.getByText("< 10")).toBeTruthy(); | ||
}); | ||
|
||
it("should have `>= 0.1` as value", async () => { | ||
await render(RangeComponent, { | ||
componentInputs: { | ||
lowerBound: 0.1, | ||
}, | ||
}); | ||
|
||
expect(screen.getByText(">= 0.1")).toBeTruthy(); | ||
}); | ||
|
||
it("should have `<= 10` as value", async () => { | ||
await render(RangeComponent, { | ||
componentInputs: { | ||
upperBound: 10, | ||
}, | ||
}); | ||
|
||
expect(screen.getByText("<= 10")).toBeTruthy(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
springwolf-ui/src/app/components/new/schema/range/range.component.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,17 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
import { Component, input } from "@angular/core"; | ||
|
||
@Component({ | ||
selector: "app-schema-range-new", | ||
templateUrl: "./range.component.html", | ||
}) | ||
export class RangeNewComponent { | ||
lowerBound = input<number>(); | ||
upperBound = input<number>(); | ||
lowerBoundInclusive = input<boolean, boolean | string>(true, { | ||
transform: (value: boolean | string) => value === true || value == "true", | ||
}); | ||
upperBoundInclusive = input<boolean, boolean | string>(true, { | ||
transform: (value: boolean | string) => value === true || value == "true", | ||
}); | ||
} |
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
Oops, something went wrong.