@angular/material/snack-bar#MAT_SNACK_BAR_DATA TypeScript Examples

The following examples show how to use @angular/material/snack-bar#MAT_SNACK_BAR_DATA. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: snackbar.component.spec.ts    From leapp with Mozilla Public License 2.0 6 votes vote down vote up
describe("SnackbarComponent", () => {
  let component: SnackbarComponent;
  let fixture: ComponentFixture<SnackbarComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [],
      providers: [
        { provide: MAT_SNACK_BAR_DATA, useValue: {} },
        { provide: MatSnackBarRef, useValue: {} },
      ].concat(mustInjected()),
    }).compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(SnackbarComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it("should create", () => {
    expect(component).toBeTruthy();
  });
});
Example #2
Source File: centered-snackbar.component.spec.ts    From WowUp with GNU General Public License v3.0 6 votes vote down vote up
describe("CenteredSnackbarComponent", () => {
  let component: CenteredSnackbarComponent;
  let fixture: ComponentFixture<CenteredSnackbarComponent>;
  let dialogData: CenteredSnackbarComponentData;

  beforeEach(async () => {
    dialogData = {
      message: "TEST MESSAGE",
    };

    await TestBed.configureTestingModule({
      declarations: [CenteredSnackbarComponent],
      imports: [MatModule, NoopAnimationsModule],
      providers: [{ provide: MAT_SNACK_BAR_DATA, useValue: dialogData }],
    }).compileComponents();
  });

  beforeEach(() => {
    fixture = TestBed.createComponent(CenteredSnackbarComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it("should create", () => {
    expect(component).toBeTruthy();
  });
});
Example #3
Source File: integration-bar.component.spec.ts    From leapp with Mozilla Public License 2.0 5 votes vote down vote up
describe("IntegrationBarComponent", () => {
  let component: IntegrationBarComponent;
  let fixture: ComponentFixture<IntegrationBarComponent>;

  beforeEach(async(() => {
    const spyRepositoryService = jasmine.createSpyObj("Repository", {
      getProfiles: [],
      getSessions: [],
      getSegments: [],
      listAwsSsoIntegrations: [],
    });
    const spyBehaviouralSubjectService = jasmine.createSpyObj("BehaviouralSubjectService", [], {
      integrations: [],
      integrations$: { subscribe: () => {} },
      setIntegrations: (_awsSsoIntegrations: AwsSsoIntegration[]) => void {},
      getIntegrations: () => [],
    });
    const spyLeappCoreService = jasmine.createSpyObj("LeappCoreService", [], {
      repository: spyRepositoryService,
      awsCoreService: { getRegions: () => ["mocked-region-1", "mocked-region-2"] },
      awsSsoOidcService: { listeners: [] },
      behaviouralSubjectService: spyBehaviouralSubjectService,
      awsSsoIntegrationService: { getIntegrations: () => [] },
    });

    TestBed.configureTestingModule({
      imports: [RouterTestingModule],
      declarations: [IntegrationBarComponent],
      providers: [
        { provide: MAT_SNACK_BAR_DATA, useValue: {} },
        { provide: MatSnackBarRef, useValue: {} },
      ].concat(mustInjected().concat([{ provide: AppProviderService, useValue: spyLeappCoreService }])),
    }).compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(IntegrationBarComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
    component.subscription = {
      unsubscribe: () => {},
    };
    component.subscription2 = {
      unsubscribe: () => {},
    };
    component.subscription3 = {
      unsubscribe: () => {},
    };
  });

  it("should create", () => {
    expect(component).toBeTruthy();
  });
});
Example #4
Source File: snackbar.component.ts    From leapp with Mozilla Public License 2.0 5 votes vote down vote up
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
  constructor(@Inject(MAT_SNACK_BAR_DATA) public data: any, private snackBar: MatSnackBar, private ngZone: NgZone) {}
Example #5
Source File: centered-snackbar.component.ts    From WowUp with GNU General Public License v3.0 5 votes vote down vote up
public constructor(@Inject(MAT_SNACK_BAR_DATA) public data: CenteredSnackbarComponentData) {}
Example #6
Source File: snackbar.component.ts    From budget-angular with GNU General Public License v3.0 5 votes vote down vote up
constructor(@Inject(MAT_SNACK_BAR_DATA) public data: any) {}
Example #7
Source File: error-snackbar.component.ts    From qbit-matUI with MIT License 5 votes vote down vote up
constructor(@Inject(MAT_SNACK_BAR_DATA) private data: any, public snackBarRef: MatSnackBarRef<ErrorSnackbarComponent>) { this.message = this.data.message; }
Example #8
Source File: info-snackbar.component.ts    From qbit-matUI with MIT License 5 votes vote down vote up
constructor(@Inject(MAT_SNACK_BAR_DATA) private data: any, public snackBarRef: MatSnackBarRef<InfoSnackbarComponent>) { this.message = this.data.message; }
Example #9
Source File: success-snackbar.component.ts    From qbit-matUI with MIT License 5 votes vote down vote up
constructor(@Inject(MAT_SNACK_BAR_DATA) private data: any, public snackBarRef: MatSnackBarRef<SuccessSnackbarComponent>) { this.message = this.data.message; }
Example #10
Source File: warn-snackbar.component.ts    From qbit-matUI with MIT License 5 votes vote down vote up
constructor(@Inject(MAT_SNACK_BAR_DATA) private data: any, public snackBarRef: MatSnackBarRef<WarnSnackbarComponent>) { this.message = this.data.message; }
Example #11
Source File: toast-message.component.ts    From fyle-mobile-app with MIT License 5 votes vote down vote up
constructor(
    @Inject(MAT_SNACK_BAR_DATA)
    public data: { icon: string; message: string; redirectionText: string; showCloseButton: boolean },
    private snackBarRef: MatSnackBarRef<ToastMessageComponent>
  ) {}
Example #12
Source File: snack-bar.component.ts    From open-genes-frontend with Mozilla Public License 2.0 5 votes vote down vote up
constructor(
    @Inject(MAT_SNACK_BAR_DATA)
    public message,
    private _windowService: WindowService,
    private cdRef: ChangeDetectorRef
  ) {
    super(_windowService);
  }