forked from fastenhealth/fasten-onprem
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storybook Integration for Component testing. (fastenhealth#142)
Co-authored-by: Serinus1 <junkmayle670@yahoo.com>
- Loading branch information
Showing
184 changed files
with
9,911 additions
and
926 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,4 @@ test.go | |
/.couchdb | ||
|
||
config.dev.yaml | ||
.cache/ |
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
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 @@ | ||
import type { StorybookConfig } from "@storybook/angular"; | ||
const config: StorybookConfig = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@storybook/addon-interactions", | ||
], | ||
framework: { | ||
name: "@storybook/angular", | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: "tag", | ||
}, | ||
}; | ||
export default config; |
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,29 @@ | ||
import type { Preview } from "@storybook/angular"; | ||
import { setCompodocJson } from "@storybook/addon-docs/angular"; | ||
import docJson from "../documentation.json"; | ||
import {applicationConfig} from "@storybook/angular"; | ||
import {importProvidersFrom} from "@angular/core"; | ||
import {HttpClientModule} from "@angular/common/http"; | ||
setCompodocJson(docJson); | ||
|
||
// see: https://github.com/storybookjs/storybook/issues/21942#issuecomment-1516177565 | ||
const decorators = [ | ||
// applicationConfig({ | ||
// providers: [importProvidersFrom(HttpClientModule)] | ||
// }) | ||
]; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
}, | ||
decorators: decorators | ||
}; | ||
|
||
export default preview; |
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,11 @@ | ||
{ | ||
"extends": "../tsconfig.app.json", | ||
"compilerOptions": { | ||
"types": ["node"], | ||
"allowSyntheticDefaultImports": true, | ||
"resolveJsonModule": true | ||
}, | ||
"exclude": ["../src/test.ts", "../src/**/*.spec.ts"], | ||
"include": ["../src/**/*", "./preview.ts"], | ||
"files": ["./typings.d.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,4 @@ | ||
declare module '*.md' { | ||
const content: string; | ||
export default content; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ -z "${CI}" ]]; then | ||
echo "running locally (not in Github Actions). generating version file from git client" | ||
GIT_TAG=`git describe --tags` | ||
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` | ||
|
||
if [[ "$GIT_BRANCH" == "main" ]]; then | ||
VERSION_INFO="${GIT_TAG}" | ||
else | ||
VERSION_INFO="${GIT_BRANCH}#${GIT_TAG}" | ||
fi | ||
else | ||
echo "running in Github Actions, generating version file from environmental variables" | ||
# https://docs.github.com/en/actions/learn-github-actions/environment-variables | ||
VERSION_INFO="${GITHUB_REF_NAME}" | ||
|
||
if [[ "$GITHUB_REF_TYPE" == "branch" ]]; then | ||
VERSION_INFO="${VERSION_INFO}#${GITHUB_SHA::7}" | ||
fi | ||
fi | ||
|
||
echo "writing version file (version: ${VERSION_INFO})" | ||
cat <<EOT > src/environments/versions.ts | ||
// this file is automatically generated by git.version.ts script | ||
export const versionInfo = { | ||
version: '${VERSION_INFO}', | ||
}; | ||
EOT |
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
2 changes: 1 addition & 1 deletion
2
frontend/src/app/components/fhir/common/badge/badge.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
45 changes: 45 additions & 0 deletions
45
frontend/src/app/components/fhir/common/badge/badge.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,45 @@ | ||
import type { Meta, StoryObj } from '@storybook/angular'; | ||
import {BadgeComponent} from "./badge.component"; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction | ||
const meta: Meta<BadgeComponent> = { | ||
title: 'Fhir/Common/Badge', | ||
component: BadgeComponent, | ||
decorators: [ | ||
// moduleMetadata({ | ||
// imports: [AppModule] | ||
// }) | ||
// applicationConfig({ | ||
// providers: [importProvidersFrom(AppModule)], | ||
// }), | ||
], | ||
tags: ['autodocs'], | ||
render: (args: BadgeComponent) => ({ | ||
props: { | ||
backgroundColor: null, | ||
...args, | ||
}, | ||
}), | ||
argTypes: { | ||
status: { | ||
control: 'text', | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<BadgeComponent>; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/angular/writing-stories/args | ||
export const Primary: Story = { | ||
args: { | ||
status: "active", | ||
} | ||
}; | ||
|
||
export const Secondary: Story = { | ||
args: { | ||
status: 'refuted' | ||
}, | ||
}; | ||
|
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.