Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(storybook): rewrite stories to CSF3 format in preparation for Storybook upgrade to v7 #151

Merged
merged 96 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
8b8af61
refactor(storybook): initial automatic conversion to CSF3 format and …
Jun 21, 2023
fed9ddb
refactor(storybook): removed explicit template from the ButtonCompone…
Jun 21, 2023
a8440ef
refactor(storybook): slimmed AccordionComponent (Angular) and cvi-acc…
Jun 21, 2023
1d36ef2
refactor(storybook): slimmed BreadcrumbsComponent (Angular) and cvi-b…
Jun 21, 2023
4a22a9b
refactor(storybook): slimmed cvi-button story down
Jun 21, 2023
5be6344
refactor(storybook): slimmed ConfirmationModalComponent (Angular) sto…
Jun 21, 2023
ff28197
refactor(storybook): slimmed ContentContainerComponent (Angular) and …
Jun 21, 2023
c6f10db
refactor(storybook): slimmed ContentPanelComponent (Angular) story down
Jun 21, 2023
472a4f2
refactor(storybook): slimmed DatepickerComponent (Angular) story down
Jun 21, 2023
77178ba
fix(storybook): fixed an issue where default value of options prop of…
Jun 21, 2023
b198977
refactor(storybook): slimmed FeedbackComponent (Angular) story down
Jun 21, 2023
3eaf180
refactor(storybook): slimmed FormItemComponent (Angular) story down
Jun 21, 2023
2df0230
refactor(storybook): slimmed HtmlSectionComponent (Angular) story down
Jun 21, 2023
daffeb9
refactor(storybook): slimmed IconComponent (Angular) story down
Jun 21, 2023
7401568
refactor(storybook): slimmed LabeledIconComponent (Angular) and cvi-l…
Jul 2, 2023
994ed90
fix(storybook): load previously missing component definition into Inp…
Jul 2, 2023
3acf5ae
refactor(storybook): slimmed InputComponent (Angular) and cvi-text-fi…
Jul 13, 2023
98e97de
Merge branch 'main' into refactor-storybook-csf3
Jul 28, 2023
28cbe3c
fix(storybook): fixed Storybook compilation errors
Jul 28, 2023
976c63f
refactor(storybook): slimmed down even more AccordionComponent (Angul…
Jul 28, 2023
9380cdb
refactor(storybook): slimmed down even more cvi-breadcrumbs stories
Jul 28, 2023
9ce67e8
refactor(storybook): slimmed down even more ButtonComponent (Angular)…
Jul 28, 2023
0e4d374
refactor(storybook): slimmed down ConfirmationModalComponent (Angular…
Jul 28, 2023
6ecdc05
refactor(storybook): slimmed down cvi-content-container stories even …
Jul 28, 2023
d2d4c37
refactor(storybook): slimmed down even more ContentPanelComponent (An…
Jul 28, 2023
286766f
refactor(storybook): slimmed down even more DatepickerComponent (Angu…
Jul 28, 2023
fa6872b
fix(ui): changed incorrect base class for DatepickerComponent and cor…
Jul 28, 2023
955eb93
refactor(storybook): slimmed down cvi-form-item stories
Jul 28, 2023
6345671
fix(storybook): fixed an issue with incorrect display of WithInlineFo…
Jul 28, 2023
47bc8f1
refactor(storybook): slimmed down cvi-html-section stories
Jul 28, 2023
77a2239
refactor(storybook): slimmed down HTML icon stories
Jul 28, 2023
d75200e
refactor(storybook): slimmed down ModalComponent (Angular) and cvi-mo…
Jul 28, 2023
df764c9
refactor(storybook): slimmed down ModalDirective (Angular) stories
Jul 28, 2023
a687c85
refactor(storybook): slimmed down NotificationComponent (Angular) and…
Jul 28, 2023
b474f67
refactor(storybook): slimmed down RadioGroupComponent (Angular) and c…
Jul 28, 2023
5fd1ce3
refactor(storybook): slimmed down ReorderableListComponent (Angular) …
Jul 28, 2023
8ea7149
fix(storybook): simplified stories of ReorderableListComponent and mo…
Jul 28, 2023
6db2041
refactor(storybook): slimmed down ScreenreaderTextComponent (Angular)…
Jul 28, 2023
e7b956e
refactor(storybook): slimmed down SelectComponent (Angular) and cvi-s…
Jul 28, 2023
e8ab9d5
fix(storybook): added missing props and args to SelectComponent story
Jul 28, 2023
a259c8c
refactor(storybook): slimmed down StatusBadgeComponent (Angular) and …
Jul 28, 2023
6b1af43
fix(storybook): removed unnecessary render methods for some default s…
Jul 28, 2023
c725c16
refactor(storybook): slimmed down StepComponent (Angular) story
Jul 28, 2023
f44b412
refactor(storybook): slimmed down StepPanelComponent (Angular) story
Jul 28, 2023
3529df2
refactor(storybook): slimmed down StepsComponent (Angular) and cvi-st…
Jul 28, 2023
f243dec
fix(storybook): fixed an issue where StepsComponent story with a step…
Jul 28, 2023
7c2115d
refactor(storybook): slimmed down TableComponent (Angular) and cvi-ta…
Jul 28, 2023
d91291f
refactor(storybook): slimmed down GeneratedTableOfContentsComponent (…
Jul 28, 2023
0e93b81
refactor(storybook): slimmed down TableOfContentsComponent (Angular) …
Jul 28, 2023
d2b57e6
refactor(storybook): slimmed down TableOfContentsItemComponent (Angul…
Jul 28, 2023
da0e024
refactor(storybook): slimmed down TableOfContentsWrapperComponent (An…
Jul 28, 2023
cef1c62
chore(storybook): improving code formatting in various stories
Jul 28, 2023
98988ff
refactor(storybook): slimmed down cvi-tab-group stories
Jul 28, 2023
d6d70e7
refactor(storybook): slimmed down TextareaComponent (Angular) and cvi…
Jul 28, 2023
cc4b51d
refactor(storybook): slimmed down ToastService (Angular) and cvi-toas…
Jul 28, 2023
4a07ebb
refactor(storybook): slimmed down TooltipDirective (Angular) and cvi-…
Jul 28, 2023
031fbca
feat(storybook): made a TooltipComponent story with custom z-index in…
Jul 28, 2023
a1a068c
refactor(storybook): slimmed down TrackComponent (Angular) and cvi-tr…
Jul 28, 2023
e4898bb
test(ui): fixed a cvi-ng-breadcrumbs e2e test
Jul 29, 2023
49e1deb
refactor(styles): fixed a BEM violation by moving disabled modifier f…
Jul 29, 2023
1cf30ee
test(ui): fixed a cvi-ng-datepicker e2e test
Jul 29, 2023
e9c3d38
test(ui): fixed a cvi-ng-input e2e test
Jul 29, 2023
1e983e4
fix(storybook): fixed incorrect "internal" JSDoc tag in cvi-ng-textarea
Jul 29, 2023
a755710
test(ui): fixed a cvi-ng-textarea e2e test
Jul 29, 2023
1117701
test(ui): fixed a cvi-ng-radio-group e2e test
Jul 29, 2023
795244e
fix(storybook): ignore an accessibility error in the Modal open witho…
Jul 29, 2023
33e1ad3
Merge branch 'main' into refactor-storybook-csf3
Aug 4, 2023
70bf5bb
Merge branch 'main' into refactor-storybook-csf3
Sep 30, 2023
d94ddc0
chore(ui): manually merge latest main
Apr 10, 2024
d2b2f2f
Merge branch 'main' into refactor-storybook-csf3
Apr 10, 2024
ec27435
Merge branch 'main' into refactor-storybook-csf3
Apr 10, 2024
831e024
fix(ui): fixed a Storybook crash
Apr 10, 2024
fa52e08
fix(ui): fixed Angular build warnings
Apr 10, 2024
2f99c8f
refactor(ng-diagrams): rewritten HierarchicalBoxDiagramComponent stor…
Apr 10, 2024
2b3aebd
refactor(storybook): rewritten All icons list story to CSF3 format
Apr 10, 2024
1790da0
refactor(ui): rewritten CircleComponent story to CSF3 format
Apr 10, 2024
7a3df2d
refactor(ui): rewritten cvi-circle story to CSF3 format
Apr 10, 2024
3fb689f
fix(ui): fixed an issue where text content of cvi-circle would not be…
Apr 10, 2024
2da5101
refactor(ui): rewritten FormMessageComponent story to CSF3 format
Apr 10, 2024
317615f
revert(ui): fix(ui): fixed Angular build warnings because of issues i…
Apr 10, 2024
062ce05
refactor(ui): rewritten LabeledItemComponent story to CSF3 format
Apr 10, 2024
eefcca4
refactor(ui): rewritten cvi-labeled-item story to CSF3 format
Apr 10, 2024
64e7599
refactor(ui): rewritten TableCardComponent story to CSF3 format
Apr 10, 2024
d26b353
refactor(ui): rewritten TableResponsiveComponent story to CSF3 format
Apr 10, 2024
3deee0c
refactor(ui): rewritten cvi-table-responsive story to CSF3 format
Apr 10, 2024
cdcf4f8
refactor(ui): rewritten TabsComponent story to CSF3 format
Apr 10, 2024
86ba7c8
refactor(ui): rewritten cvi-tabs story to CSF3 format
Apr 10, 2024
4fec881
refactor(ui): rewritten TimedNoticeComponent story to CSF3 format
Apr 10, 2024
8cbd7ed
refactor(ui): rewritten cvi-timed-notice story to CSF3 format and fix…
Apr 10, 2024
e2690f9
fix(storybook): ignore an Icons list story attached to an MDX file in…
Apr 10, 2024
a225eda
fix(ui): fixed broken WithIconCustomStyle story for ButtonComponent
Apr 10, 2024
d9b3331
fix(ui): fixed broken HtmlSectionComponent story
Apr 10, 2024
e7b5ece
chore(all): upgraded Chromatic to the latest version
Apr 10, 2024
5086274
test(ui-e2e): fixed a StepsComponent test
Apr 10, 2024
cc87c7e
test(ui-e2e): removed a faulty StepsComponent test
Apr 10, 2024
7130d91
chore(all): added a separate package.json command for interactive E2E…
Apr 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/ui-e2e/src/component/breadcrumbs.component.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('BreadcrumbsComponent', () => {
cy.loadStory('Angular Breadcrumbs', 'Default')
.get('cvi-ng-breadcrumbs')
.shouldExist('cvi-ng-track')
.shouldNotExist('cvi-ng-icon')
.shouldNotBeVisible('cvi-ng-icon')
.shouldHaveClasses('ul', 'cvi-breadcrumbs__items')
.shouldHaveClasses('li', 'cvi-breadcrumbs__item')
.shouldHaveClasses('a', 'cvi-breadcrumbs__item-link');
Expand Down
12 changes: 6 additions & 6 deletions apps/ui-e2e/src/component/datepicker.component.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('DatepickerComponent', () => {

it('renders default story', () => {
cy.loadStory('Angular Form Datepicker', 'Default')
.shouldHaveClasses('cvi-ng-datepicker', 'cvi-textfield')
.shouldHaveClasses('cvi-ng-datepicker', 'cvi-datepicker')
.shouldHaveClasses('input', 'cvi-datepicker__input-field')
.changeArg('htmlId', 'Qwerty123')
.shouldHaveAttributes('input', [
Expand All @@ -21,24 +21,24 @@ describe('DatepickerComponent', () => {
.changeArg('disabled', true);

cy.shouldHaveClasses('cvi-ng-datepicker', [
'cvi-textfield',
'cvi-datepicker__input-container--is-disabled',
'cvi-datepicker',
'cvi-datepicker--is-disabled',
])
.shouldHaveAttributes('input', [{ name: 'id', value: 'Qwerty123' }])
.and('be.disabled');

cy.get('cvi-ng-datepicker')
.changeArg('disabled', false)
.shouldNotHaveClasses('cvi-ng-datepicker', [
'cvi-datepicker__input-container--is-disabled',
'cvi-datepicker--is-disabled',
]);
});

it('can select dates from the calendar', () => {
cy.loadStory('Angular Form Datepicker', 'Default')
.get('cvi-ng-datepicker')
.click()
.shouldHaveClasses('cvi-ng-datepicker-calendar div', [
.shouldHaveClasses('cvi-ng-datepicker-calendar > div', [
'cvi-datepicker__calendar',
])
.get('button.cvi-datepicker__calendar-button')
Expand All @@ -55,7 +55,7 @@ describe('DatepickerComponent', () => {
.should('have.value', '')
.type('28.02.2023')
.click()
.shouldHaveClasses('cvi-ng-datepicker-calendar div', [
.shouldHaveClasses('cvi-ng-datepicker-calendar > div', [
'cvi-datepicker__calendar',
])
.get('button.cvi-datepicker__calendar-button')
Expand Down
7 changes: 5 additions & 2 deletions apps/ui-e2e/src/component/radio-group.component.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('RadioGroupComponent', () => {
});

it('Renders option radio buttons group and clicks first button', () => {
cy.loadStory('Angular Form Radio Button Group', 'Option Button')
cy.loadStory('Angular Form Radio Button Group', 'With Option Buttons')
.runRadioGroupCommonTest('regular')
.get('[data-cy="option_1"]')
.within(() => {
Expand All @@ -39,7 +39,10 @@ describe('RadioGroupComponent', () => {
});

it('Renders option button compact and clicks first button', () => {
cy.loadStory('Angular Form Radio Button Group', 'Option Button Compact')
cy.loadStory(
'Angular Form Radio Button Group',
'With Compact Option Buttons'
)
.runRadioGroupCommonTest('compact')
.get('[data-cy="option_1"]')
.within(() => {
Expand Down
16 changes: 4 additions & 12 deletions apps/ui-e2e/src/component/steps.component.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,10 @@ describe('StepsComponent', () => {
]);
});

it('Renders mobile steps and clicks on the first step', () => {
cy.loadStory('Angular Steps Steps', 'Mobile').setDevice('mobile');

cy.shouldExist('[data-cy="steps-description"]');

cy.runStepsCommonTest();
});

it('Renders steps with observable titles and clicks on the first step', () => {
cy.loadStory(
'Angular Steps Steps',
'With Observable Titles'
).runStepsCommonTest();
cy.loadStory('Angular Steps Steps', 'With Observable Titles');
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1500);
cy.runStepsCommonTest();
});
});
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { Meta, moduleMetadata, Story } from '@storybook/angular';
import { Meta } from '@storybook/angular';
import { HierarchicalBoxDiagramComponent } from './hierarchical-box-diagram.component';
import notes from './hierarchical-box-diagram.component.html.md';

export default {
title: 'Angular Diagrams/Hierarchical Box Diagram',
component: HierarchicalBoxDiagramComponent,
decorators: [
moduleMetadata({
imports: [],
}),
],
parameters: {
notes,
layout: 'fullscreen',
Expand All @@ -32,80 +27,75 @@ export default {
},
} as Meta<HierarchicalBoxDiagramComponent>;

const Template: Story<HierarchicalBoxDiagramComponent> = (
args: HierarchicalBoxDiagramComponent
) => ({
props: args,
});

export const Default = Template.bind({});
Default.args = {
boxes: [
{
...baseBoxStyles('#F0F0F2', 'solid', '#D73E3E'),
id: '1',
href: 'https://example.com/1',
label: '<p style="color:#D73E3E">Health concern</p>',
targets: ['2', '7'],
},
...defaultBoxes([
export const Default = {
args: {
boxes: [
{
id: '2',
href: 'https://example.com/2',
label: 'I have a minor health issue',
targets: ['3', '4', '5'],
...baseBoxStyles('#F0F0F2', 'solid', '#D73E3E'),
id: '1',
href: 'https://example.com/1',
label: '<p style="color:#D73E3E">Health concern</p>',
targets: ['2', '7'],
},
{ id: '3', href: 'https://example.com/3', label: 'Pharmacy' },
{ id: '4', href: 'https://example.com/4', label: 'Helpline 1220' },
...defaultBoxes([
{
id: '2',
href: 'https://example.com/2',
label: 'I have a minor health issue',
targets: ['3', '4', '5'],
},
{ id: '3', href: 'https://example.com/3', label: 'Pharmacy' },
{ id: '4', href: 'https://example.com/4', label: 'Helpline 1220' },
{
id: '5',
href: 'https://example.com/5',
label: '<b>Family doctor</b>',
targets: ['6', '9'],
},
]),
{
id: '5',
href: 'https://example.com/5',
label: '<b>Family doctor</b>',
targets: ['6', '9'],
...dottedBoxStyles('#B9D2E5', '#3B85BD'),
id: '6',
href: 'https://example.com/6',
label: 'Specialist doctor',
targets: ['9'],
},
]),
{
...dottedBoxStyles('#B9D2E5', '#3B85BD'),
id: '6',
href: 'https://example.com/6',
label: 'Specialist doctor',
targets: ['9'],
},
{
...baseBoxStyles('#CECFD8'),
id: '9',
href: 'https://example.com/9',
label: 'Conclusions/Referrals',
targets: ['10', '11'],
},
{
...dottedBoxStyles('#ECF4EF', '#399E43'),
id: '10',
href: 'https://example.com/10',
label: 'Treatment at home',
},
{
...baseBoxStyles('#FBEDED'),
id: '7',
href: 'https://example.com/7',
label: 'I have an acute health issue and need emergency care',
targets: ['8'],
},
{
...baseBoxStyles('#FCEEEE'),
id: '8',
href: 'https://example.com/8',
label: '<b>Call 112 or go to ER</b>',
targets: ['11'],
},
{
...dottedBoxStyles('#FCEEEE', '#D73E3E'),
id: '11',
href: 'https://example.com/11',
label: 'Hospitalization',
targets: ['9'],
},
],
{
...baseBoxStyles('#CECFD8'),
id: '9',
href: 'https://example.com/9',
label: 'Conclusions/Referrals',
targets: ['10', '11'],
},
{
...dottedBoxStyles('#ECF4EF', '#399E43'),
id: '10',
href: 'https://example.com/10',
label: 'Treatment at home',
},
{
...baseBoxStyles('#FBEDED'),
id: '7',
href: 'https://example.com/7',
label: 'I have an acute health issue and need emergency care',
targets: ['8'],
},
{
...baseBoxStyles('#FCEEEE'),
id: '8',
href: 'https://example.com/8',
label: '<b>Call 112 or go to ER</b>',
targets: ['11'],
},
{
...dottedBoxStyles('#FCEEEE', '#D73E3E'),
id: '11',
href: 'https://example.com/11',
label: 'Hospitalization',
targets: ['9'],
},
],
},
};

function baseBoxStyles(
Expand Down
40 changes: 3 additions & 37 deletions libs/storybook/src/lib/stories/icons/list.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,42 +1,8 @@
import {Meta, Story} from '@storybook/addon-docs';
import { storybookIconsNames } from '../../../../../ui/src/lib/icons/storybook-icons';
import * as IconsListStories from './list.stories.ts';

<Meta title="Icons/Available Icons" parameters={{
layout: 'padded',
axe: {
skip: true,
},
backgrounds: {
default: 'Darkgray',
},
}} argTypes={{
fill: {
name: 'Icon color',
control: { type: 'color' }
}
}} args={{ fill: 'red' }} />

export const Template = (args) => ({
props: {
...args,
icons: storybookIconsNames,
filteredIcons: storybookIconsNames,
filterIcons: (query, icons) => {
return query ? icons.filter(iconName => iconName.includes(query)) : icons;
}
},
template: `
<input type="text" #search (input)="filteredIcons = filterIcons(search.value, icons)" cviNgStorybookInput placeholder="Type icon name...">
<cvi-ng-storybook-icon-cards>
<cvi-ng-storybook-icon-card *ngFor="let name of filteredIcons" [label]="name" [ngStyle]="{ 'fill': fill }">
<cvi-ng-icon [name]="name"></cvi-ng-icon>
</cvi-ng-storybook-icon-card>
</cvi-ng-storybook-icon-cards>
`
});
<Meta of={IconsListStories} />

Switch to *Canvas* tab for a full-screen view.

<Story name="All icons" height="540px">
{ Template.bind({}) }
</Story>
<Story name="All icons" height="540px" of={IconsListStories.Default} />
49 changes: 49 additions & 0 deletions libs/storybook/src/lib/stories/icons/list.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Meta } from '@storybook/angular';
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import { storybookIconsNames } from '../../../../../ui/src/lib/icons/storybook-icons';

export default {
title: 'Icons/Available Icons',
parameters: {
layout: 'padded',
axe: {
skip: true,
},
chromatic: { disableSnapshot: true },
backgrounds: {
default: 'Darkgray',
},
},
argTypes: {
fill: {
name: 'Icon color',
control: { type: 'color' },
},
},
args: {
fill: 'red',
},
} as Meta;

export const Default = {
render: (args: any) => ({
props: {
...args,
icons: storybookIconsNames,
filteredIcons: storybookIconsNames,
filterIcons: (query: string, icons: string[]) => {
return query
? icons.filter((iconName) => iconName.includes(query))
: icons;
},
},
template: `
<input type="text" #search (input)="filteredIcons = filterIcons(search.value, icons)" cviNgStorybookInput placeholder="Type icon name...">
<cvi-ng-storybook-icon-cards>
<cvi-ng-storybook-icon-card *ngFor="let name of filteredIcons" [label]="name" [ngStyle]="{ 'fill': fill }">
<cvi-ng-icon [name]="name"></cvi-ng-icon>
</cvi-ng-storybook-icon-card>
</cvi-ng-storybook-icon-cards>
`,
}),
};
Loading
Loading