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.
feat(empty-state): Progressive enhancements for relayout based on Res…
…izeObserver. Fixes #648
- Loading branch information
1 parent
6f230a5
commit 532e275
Showing
9 changed files
with
237 additions
and
28 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
51 changes: 51 additions & 0 deletions
51
apps/components-e2e/src/components/empty-state/empty-state.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,51 @@ | ||
/** | ||
* @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 { resetWindowSizeToDefault, waitForAngular } from '../../utils'; | ||
import { emptyStateItem, emptyStateHorizontalWrapper } from './empty-state.po'; | ||
|
||
fixture('Empty state') | ||
.page('http://localhost:4200/empty-state') | ||
.beforeEach(async () => { | ||
await waitForAngular(); | ||
await resetWindowSizeToDefault(); | ||
}); | ||
|
||
test('should show three items vertically aligned', async (testController: TestController) => { | ||
await testController | ||
.expect(emptyStateItem.count) | ||
.eql(3) | ||
.expect(emptyStateHorizontalWrapper.exists) | ||
.notOk(); | ||
}); | ||
|
||
test('should show three items horizontally aligned on smaller screens', async (testController: TestController) => { | ||
await testController | ||
.resizeWindow(570, 800) | ||
.expect(emptyStateItem.count) | ||
.eql(3) | ||
.expect(emptyStateHorizontalWrapper.exists) | ||
.ok(); | ||
}); | ||
|
||
test('should show three items vertically aligned on very small screens', async (testController: TestController) => { | ||
await testController | ||
.resizeWindow(250, 800) | ||
.expect(emptyStateItem.count) | ||
.eql(3) | ||
.expect(emptyStateHorizontalWrapper.exists) | ||
.notOk(); | ||
}); |
34 changes: 34 additions & 0 deletions
34
apps/components-e2e/src/components/empty-state/empty-state.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,34 @@ | ||
<dt-empty-state> | ||
<dt-empty-state-item> | ||
<!-- Give the empty state item an aria-level to indicate which level of heading it represents within the page --> | ||
<dt-empty-state-item-title aria-level="2"> | ||
Optional Heading 1 | ||
</dt-empty-state-item-title> | ||
|
||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy | ||
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam | ||
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. | ||
</dt-empty-state-item> | ||
|
||
<dt-empty-state-item> | ||
<!-- Give the empty state item an aria-level to indicate which level of heading it represents within the page --> | ||
<dt-empty-state-item-title aria-level="2"> | ||
Optional Heading 2 | ||
</dt-empty-state-item-title> | ||
|
||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy | ||
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam | ||
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. | ||
</dt-empty-state-item> | ||
|
||
<dt-empty-state-item> | ||
<!-- Give the empty state item an aria-level to indicate which level of heading it represents within the page --> | ||
<dt-empty-state-item-title aria-level="2"> | ||
Optional Heading 3 | ||
</dt-empty-state-item-title> | ||
|
||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy | ||
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam | ||
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. | ||
</dt-empty-state-item> | ||
</dt-empty-state> |
31 changes: 31 additions & 0 deletions
31
apps/components-e2e/src/components/empty-state/empty-state.module.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,31 @@ | ||
/** | ||
* @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 { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { Route, RouterModule } from '@angular/router'; | ||
import { DtEmptyStateModule } from '@dynatrace/barista-components/empty-state'; | ||
import { DtE2EEmptyState } from './empty-state'; | ||
|
||
const routes: Route[] = [{ path: '', component: DtE2EEmptyState }]; | ||
|
||
@NgModule({ | ||
declarations: [DtE2EEmptyState], | ||
imports: [CommonModule, RouterModule.forChild(routes), DtEmptyStateModule], | ||
exports: [], | ||
providers: [], | ||
}) | ||
export class DtE2EEmptyStateModule {} |
23 changes: 23 additions & 0 deletions
23
apps/components-e2e/src/components/empty-state/empty-state.po.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,23 @@ | ||
/** | ||
* @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'; | ||
|
||
export const emptyStateHorizontalWrapper = Selector( | ||
'.dt-empty-state-items-horizontal', | ||
); | ||
|
||
export const emptyStateItem = Selector('.dt-empty-state-item'); |
23 changes: 23 additions & 0 deletions
23
apps/components-e2e/src/components/empty-state/empty-state.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,23 @@ | ||
/** | ||
* @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'; | ||
|
||
@Component({ | ||
selector: 'dt-e2e-empty-state', | ||
templateUrl: 'empty-state.html', | ||
}) | ||
export class DtE2EEmptyState {} |
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 was deleted.
Oops, something went wrong.