This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(chart): Fixes an issue where the range could not be re-opened aft…
…er closing. Fixed a regression that was introduced in version 5.1.0 where range could not be re-opened in a range only mode after it was closed once.
- Loading branch information
1 parent
ec0d901
commit 1718a21
Showing
7 changed files
with
202 additions
and
12 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
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
88 changes: 88 additions & 0 deletions
88
apps/components-e2e/src/components/chart/selection-area/timestamp/timestamp.e2e.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,88 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Selector } from 'testcafe'; | ||
import { waitForAngular } from '../../../../utils'; | ||
import { | ||
chartClickTargets, | ||
closeButton, | ||
createTimestamp, | ||
overlayText, | ||
rangeSelection, | ||
selection, | ||
timestampSelection, | ||
createRange, | ||
} from '../selection-area.po'; | ||
|
||
const closeCounter = Selector('.closed-counter'); | ||
|
||
fixture('Selection Area Timestamp Only') | ||
.page('http://localhost:4200/chart/selection-area/timestamp') | ||
.beforeEach(async (testController: TestController) => { | ||
await testController.resizeWindow(1200, 800); | ||
await waitForAngular(); | ||
}); | ||
|
||
test('should not have an initial timestamp selection', async (testController: TestController) => { | ||
await testController | ||
.expect(selection.exists) | ||
.notOk() | ||
.expect(timestampSelection.exists) | ||
.notOk() | ||
.expect(closeCounter.textContent) | ||
.eql('0'); | ||
}); | ||
|
||
test('should create a timestamp close it and reopen it', async (testController: TestController) => { | ||
await createTimestamp( | ||
{ x: 450, y: 100 }, | ||
chartClickTargets[1], | ||
testController, | ||
) | ||
.expect(overlayText.textContent) | ||
.match(/Jul 31, \d{2}:19/g) | ||
.click(closeButton, { speed: 0.3 }) | ||
.expect(rangeSelection.exists) | ||
.notOk(); | ||
|
||
await createTimestamp( | ||
{ x: 450, y: 100 }, | ||
chartClickTargets[1], | ||
testController, | ||
) | ||
.expect(timestampSelection.exists) | ||
.ok() | ||
.expect(overlayText.textContent) | ||
.match(/Jul 31, \d{2}:19/g); | ||
}); | ||
|
||
test('should leave the timestamp untouched if a range is created in a timestamp only mode', async (testController: TestController) => { | ||
await createTimestamp( | ||
{ x: 450, y: 100 }, | ||
chartClickTargets[1], | ||
testController, | ||
) | ||
.expect(timestampSelection.exists) | ||
.ok(); | ||
|
||
await createRange(520, { x: 310, y: 100 }) | ||
.expect(rangeSelection.exists) | ||
.notOk() | ||
.expect(timestampSelection.exists) | ||
.ok() | ||
.expect(overlayText.textContent) | ||
.match(/Jul 31, \d{2}:19/g); | ||
}); |
10 changes: 10 additions & 0 deletions
10
apps/components-e2e/src/components/chart/selection-area/timestamp/timestamp.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,10 @@ | ||
<dt-chart [options]="options" [series]="series$ | async"> | ||
<dt-chart-timestamp | ||
aria-label-close="Close the selection" | ||
(closed)="closed()" | ||
(valueChanges)="valueChanges($event)" | ||
></dt-chart-timestamp> | ||
</dt-chart> | ||
|
||
<div class="closed-counter">{{ closedCounter }}</div> | ||
<div class="current-value">{{ currentValue }}</div> |
48 changes: 48 additions & 0 deletions
48
apps/components-e2e/src/components/chart/selection-area/timestamp/timestamp.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,48 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Component } from '@angular/core'; | ||
import { DtE2EChartBase } from '../../chart-base'; | ||
import { DataService } from '../../../../services/data.service'; | ||
|
||
@Component({ | ||
selector: 'dt-e2e-timestamp', | ||
templateUrl: './timestamp.html', | ||
styles: [ | ||
` | ||
:host { | ||
display: block; | ||
width: 1200px; | ||
} | ||
`, | ||
], | ||
}) | ||
export class DtE2ETimestamp extends DtE2EChartBase { | ||
closedCounter = 0; | ||
currentValue; | ||
|
||
constructor(dataService: DataService) { | ||
super(dataService); | ||
} | ||
|
||
closed(): void { | ||
this.closedCounter++; | ||
} | ||
|
||
valueChanges(_value: number): void { | ||
this.currentValue = _value; | ||
} | ||
} |
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