mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
Fix header stories (#4745)
* Fix header stories * Add stories to tsconfig
This commit is contained in:
@@ -1,16 +1,19 @@
|
|||||||
import { Component, Injectable } from "@angular/core";
|
import { Component, Injectable } from "@angular/core";
|
||||||
import { RouterModule } from "@angular/router";
|
import { RouterModule } from "@angular/router";
|
||||||
import { Meta, Story, moduleMetadata, componentWrapperDecorator } from "@storybook/angular";
|
import { Meta, Story, moduleMetadata, componentWrapperDecorator } from "@storybook/angular";
|
||||||
import { Observable } from "rxjs";
|
import { BehaviorSubject } from "rxjs";
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import {
|
import {
|
||||||
|
AvatarModule,
|
||||||
BreadcrumbsModule,
|
BreadcrumbsModule,
|
||||||
ButtonModule,
|
ButtonModule,
|
||||||
NavigationModule,
|
|
||||||
IconModule,
|
|
||||||
IconButtonModule,
|
IconButtonModule,
|
||||||
|
IconModule,
|
||||||
|
MenuModule,
|
||||||
|
NavigationModule,
|
||||||
TabsModule,
|
TabsModule,
|
||||||
} from "@bitwarden/components";
|
} from "@bitwarden/components";
|
||||||
import { InputModule } from "@bitwarden/components/src/input/input.module";
|
import { InputModule } from "@bitwarden/components/src/input/input.module";
|
||||||
@@ -20,8 +23,14 @@ import { HeaderComponent } from "./header.component";
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
class MockStateService {
|
class MockStateService {
|
||||||
activeAccount$ = new Observable();
|
activeAccount$ = new BehaviorSubject("1").asObservable();
|
||||||
accounts$ = new Observable();
|
accounts$ = new BehaviorSubject({ "1": { profile: { name: "Foo" } } }).asObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
class MockMessagingService implements MessagingService {
|
||||||
|
send(subscriber: string, arg?: any) {
|
||||||
|
alert(subscriber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -49,17 +58,27 @@ export default {
|
|||||||
],
|
],
|
||||||
{ useHash: true }
|
{ useHash: true }
|
||||||
),
|
),
|
||||||
|
AvatarModule,
|
||||||
BreadcrumbsModule,
|
BreadcrumbsModule,
|
||||||
ButtonModule,
|
ButtonModule,
|
||||||
InputModule,
|
|
||||||
IconModule,
|
|
||||||
IconButtonModule,
|
IconButtonModule,
|
||||||
|
IconModule,
|
||||||
|
InputModule,
|
||||||
|
MenuModule,
|
||||||
NavigationModule,
|
NavigationModule,
|
||||||
PreloadedEnglishI18nModule,
|
PreloadedEnglishI18nModule,
|
||||||
TabsModule,
|
TabsModule,
|
||||||
],
|
],
|
||||||
declarations: [HeaderComponent, MockProductSwitcher],
|
declarations: [HeaderComponent, MockProductSwitcher],
|
||||||
providers: [{ provide: StateService, useClass: MockStateService }],
|
providers: [
|
||||||
|
{ provide: StateService, useClass: MockStateService },
|
||||||
|
{
|
||||||
|
provide: MessagingService,
|
||||||
|
useFactory: () => {
|
||||||
|
return new MockMessagingService();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
} as Meta;
|
} as Meta;
|
||||||
|
|||||||
@@ -7,5 +7,6 @@
|
|||||||
"@bitwarden/angular/*": ["../../libs/angular/src/*"],
|
"@bitwarden/angular/*": ["../../libs/angular/src/*"],
|
||||||
"@bitwarden/components": ["../../libs/components/src"]
|
"@bitwarden/components": ["../../libs/components/src"]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"include": ["src/**/*.stories.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user