= (args: MyTestCmpComponent) => ({
component: MyTestCmpComponent,
props: args,
});
export const Primary = Template.bind({});
Primary.args = {
}
`
);
// build Angular lib
runCLI(`run ${angularStorybookLib}:build-storybook`);
checkFilesExist(`dist/storybook/${angularStorybookLib}/index.html`);
expect(
readFile(`dist/storybook/${angularStorybookLib}/index.html`)
).toContain(`Storybook`);
}, 1000000);
});
});
});
export function createTestUILib(libName: string): void {
runCLI(
`g @nrwl/angular:library ${libName} --no-interactive --buildable=true`
);
runCLI(
`g @nrwl/angular:component test-button --project=${libName} --no-interactive`
);
writeFileSync(
tmpProjPath(`libs/${libName}/src/lib/test-button/test-button.component.ts`),
`
import { Component, OnInit, Input } from '@angular/core';
export type ButtonStyle = 'default' | 'primary' | 'accent';
@Component({
selector: 'proj-test-button',
templateUrl: './test-button.component.html',
styleUrls: ['./test-button.component.css']
})
export class TestButtonComponent implements OnInit {
@Input('buttonType') buttonType = 'button';
@Input() style: ButtonStyle = 'default';
@Input() age!: number;
@Input() isDisabled = false;
constructor() { }
ngOnInit() {
}
}
`
);
writeFileSync(
tmpProjPath(
`libs/${libName}/src/lib/test-button/test-button.component.html`
),
`
You are {{age}} years old.
`
);
runCLI(
`g @nrwl/angular:component test-other --project=${libName} --no-interactive`
);
}