-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2206 from DSD-DBS/update-repo-dialog
chore: Update Delete Repo Dialog to use modern Angular Control Flow
- Loading branch information
Showing
7 changed files
with
109 additions
and
26 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
4 changes: 0 additions & 4 deletions
4
...tings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.component.css
This file was deleted.
Oops, something went wrong.
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
4 changes: 0 additions & 4 deletions
4
...ngs/t4c-instance-settings/t4c-repo-deletion-dialog/t4c-repo-deletion-dialog.component.css
This file was deleted.
Oops, something went wrong.
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
91 changes: 91 additions & 0 deletions
91
...ttings/t4c-instance-settings/t4c-repo-deletion-dialog/t4c-repo-deletion-dialog.stories.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,91 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { MAT_DIALOG_DATA } from '@angular/material/dialog'; | ||
import { Meta, moduleMetadata, StoryObj } from '@storybook/angular'; | ||
import { userEvent, within } from '@storybook/test'; | ||
import { dialogWrapper } from 'src/storybook/decorators'; | ||
import { mockSimpleToolModel } from '../../../../../../storybook/model'; | ||
import { | ||
mockT4CInstance, | ||
mockT4CRepositoryWrapperServiceProvider, | ||
} from '../../../../../../storybook/t4c'; | ||
import { T4CRepoDeletionDialogComponent } from './t4c-repo-deletion-dialog.component'; | ||
|
||
const meta: Meta<T4CRepoDeletionDialogComponent> = { | ||
title: 'Settings Components/Modelsources/T4C/Delete Repo Dialog', | ||
component: T4CRepoDeletionDialogComponent, | ||
decorators: [ | ||
moduleMetadata({ | ||
providers: [ | ||
mockT4CRepositoryWrapperServiceProvider([ | ||
{ | ||
id: 1, | ||
name: 'test-repo', | ||
instance: mockT4CInstance, | ||
status: 'ONLINE', | ||
integrations: [ | ||
{ | ||
id: 1, | ||
name: 'mockModel', | ||
model: mockSimpleToolModel, | ||
}, | ||
{ | ||
id: 2, | ||
name: 'mockModel 2', | ||
model: mockSimpleToolModel, | ||
}, | ||
], | ||
}, | ||
]), | ||
{ | ||
provide: MAT_DIALOG_DATA, | ||
useValue: { | ||
id: 1, | ||
name: 'test-repo', | ||
instance: mockT4CInstance, | ||
integrations: [ | ||
{ | ||
id: 1, | ||
name: 'mockModel', | ||
model: mockSimpleToolModel, | ||
}, | ||
{ | ||
id: 2, | ||
name: 'mockModel 2', | ||
model: mockSimpleToolModel, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
}), | ||
dialogWrapper, | ||
], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<T4CRepoDeletionDialogComponent>; | ||
|
||
export const Empty: Story = { | ||
args: {}, | ||
}; | ||
|
||
export const InvalidContent: Story = { | ||
args: {}, | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
const deleteRepoInput = canvas.getByTestId('delete-repo-input'); | ||
await userEvent.type(deleteRepoInput, 'invalid-text'); | ||
}, | ||
}; | ||
|
||
export const ValidContent: Story = { | ||
args: {}, | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
const deleteRepoInput = canvas.getByTestId('delete-repo-input'); | ||
await userEvent.type(deleteRepoInput, 'test-repo'); | ||
}, | ||
}; |