-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(ui): add `Storybook` * feat(ui): add `Storybook` e2e test * doc(ui): how to watch e2e * build(dep): update storybook to `v5.3.6` * build(dep): back to storybook `v5.3.2` due to: - info => Using angular project 'frontend' for configuring Storybook. * build(dep): back to storybook `v5.3.6` since it works * test(ui-e2e): open/close `menu-bar`
- Loading branch information
1 parent
64a9c08
commit a328f09
Showing
29 changed files
with
3,914 additions
and
121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@storybook/addon-knobs/register'; |
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,5 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"exclude": ["../**/test.ts", "../**/*.spec.ts"], | ||
"include": ["../**/*"] | ||
} |
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 @@ | ||
// Export a function. Accept the base config as the only param. | ||
module.exports = async ({ config, mode }) => { | ||
// `mode` has a value of 'DEVELOPMENT' or 'PRODUCTION' | ||
// You can change the configuration based on that. | ||
// 'PRODUCTION' is used when building the static version of storybook. | ||
|
||
// Make whatever fine-grained changes you need | ||
|
||
// Return the altered config | ||
return 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
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,13 @@ | ||
{ | ||
"baseUrl": "http://localhost:4400", | ||
"chromeWebSecurity": false, | ||
"fileServerFolder": ".", | ||
"fixturesFolder": "./src/fixtures", | ||
"integrationFolder": "./src/integration", | ||
"modifyObstructiveCode": false, | ||
"pluginsFile": "./src/plugins/index", | ||
"screenshotsFolder": "../../dist/cypress/apps/ui-e2e/screenshots", | ||
"supportFile": "./src/support/index.ts", | ||
"video": true, | ||
"videosFolder": "../../dist/cypress/apps/ui-e2e/videos" | ||
} |
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 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io" | ||
} |
40 changes: 40 additions & 0 deletions
40
apps/ui-e2e/src/integration/menu-bar/menu-bar.component.spec.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,40 @@ | ||
import { UiMenuBarConfig } from '@talus/ui'; | ||
|
||
const menuConfig: UiMenuBarConfig<string> = { | ||
menus: [ | ||
{ | ||
label: 'Edit', | ||
menuItems: [ | ||
{ | ||
icon: 'undo', | ||
label: 'Undo', | ||
value: 'undo()', | ||
}, | ||
{ | ||
icon: 'redo', | ||
label: 'Redo', | ||
value: 'redo()', | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
describe('ui', () => { | ||
beforeEach(() => | ||
cy.visit( | ||
`/iframe.html?id=uimenubarcomponent--primary&knob-menuConfig=${JSON.stringify(menuConfig)}`, | ||
), | ||
); | ||
|
||
it('should render all menus/menu-items & and open/close menu', () => { | ||
cy.get('ui-menu-bar').should('exist'); | ||
|
||
cy.get('.mat-menu-trigger').click(); | ||
cy.get('.mat-menu-content').should('have.length', menuConfig.menus.length); | ||
cy.get('.mat-menu-item').should('have.length', menuConfig.menus[0].menuItems.length); | ||
|
||
cy.get('.cdk-overlay-backdrop').click(); | ||
cy.get('.mat-menu-content').should('not.exist'); | ||
}); | ||
}); |
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,22 @@ | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor'); | ||
|
||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
|
||
// Preprocess Typescript | ||
on('file:preprocessor', preprocessTypescript(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,31 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
declare namespace Cypress { | ||
interface Chainable<Subject> { | ||
login(email: string, password: string): void; | ||
} | ||
} | ||
// | ||
// -- This is a parent command -- | ||
Cypress.Commands.add('login', (email, password) => { | ||
console.log('Custom command example: Login', email, password); | ||
}); | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) |
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 @@ | ||
// *********************************************************** | ||
// This example support/index.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands'; |
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,8 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"sourceMap": false, | ||
"outDir": "../../dist/out-tsc" | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.js"] | ||
} |
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,7 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"types": ["cypress", "node"] | ||
}, | ||
"include": ["**/*.ts", "**/*.js"] | ||
} |
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 @@ | ||
{ "extends": "../../tslint.json", "rules": {} } |
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 @@ | ||
import '../../../.storybook/addons'; |
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,5 @@ | ||
import { addDecorator, configure } from '@storybook/angular'; | ||
import { withKnobs } from '@storybook/addon-knobs'; | ||
|
||
addDecorator(withKnobs); | ||
configure(require.context('../src/lib', true, /\.stories\.tsx?$/), module); |
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 @@ | ||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" /> |
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,8 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"emitDecoratorMetadata": true | ||
}, | ||
"exclude": ["../src/test.ts", "../**/*.spec.ts"], | ||
"include": ["../src/**/*"] | ||
} |
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,7 @@ | ||
const rootWebpackConfig = require('../../../.storybook/webpack.config'); | ||
// Export a function. Accept the base config as the only param. | ||
module.exports = async ({ config, mode }) => { | ||
config = await rootWebpackConfig({ config, mode }); | ||
|
||
return 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
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,35 @@ | ||
import { object } from '@storybook/addon-knobs'; | ||
import { UiMenuBarComponent, UiMenuBarConfig } from './menu-bar.component'; | ||
import { UiMenuBarModule } from './menu-bar.module'; | ||
|
||
export default { | ||
title: 'UiMenuBarComponent', | ||
}; | ||
|
||
export const primary = () => ({ | ||
moduleMetadata: { | ||
imports: [UiMenuBarModule], | ||
}, | ||
component: UiMenuBarComponent, | ||
props: { | ||
menuConfig: object<UiMenuBarConfig<string>>('menuConfig', { | ||
menus: [ | ||
{ | ||
label: 'Edit', | ||
menuItems: [ | ||
{ | ||
icon: 'undo', | ||
label: 'Undo', | ||
value: 'Test undo value', | ||
}, | ||
{ | ||
icon: 'redo', | ||
label: 'Redo', | ||
value: 'Test redo value', | ||
}, | ||
], | ||
}, | ||
], | ||
}), | ||
}, | ||
}); |
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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { MatButtonModule, MatIconModule, MatMenuModule, MatToolbarModule } from '@angular/material'; | ||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { UiMenuBarComponent } from './menu-bar.component'; | ||
|
||
@NgModule({ | ||
declarations: [UiMenuBarComponent], | ||
imports: [CommonModule, MatButtonModule, MatIconModule, MatMenuModule, MatToolbarModule], | ||
imports: [ | ||
BrowserAnimationsModule, | ||
CommonModule, | ||
MatButtonModule, | ||
MatIconModule, | ||
MatMenuModule, | ||
MatToolbarModule, | ||
], | ||
exports: [UiMenuBarComponent], | ||
}) | ||
export class UiMenuBarModule {} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.