/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { Component, DebugElement } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { MatBadgeModule } from '@angular/material/badge';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';
import { By } from '@angular/platform-browser';
import { CommandbarButtonComponent } from './button/commandbar-button.component';
import { CommandbarButtonsDirective } from './commandbar-buttons.directive';

@Component({
  template: '<bci-commandbar-button bciCommandbarActionAdd></bci-commandbar-button>',
})
class TestComponent {}

describe('CommandbarButtonsDirective', () => {
  let fixture: ComponentFixture<TestComponent>;
  let component: TestComponent;
  let button: CommandbarButtonComponent;
  let debugElement: DebugElement;

  beforeEach(
    waitForAsync(() => {
      TestBed.configureTestingModule({
        imports: [MatIconModule, MatTooltipModule, MatBadgeModule],
        declarations: [TestComponent, CommandbarButtonsDirective, CommandbarButtonComponent],
      }).compileComponents();
      fixture = TestBed.createComponent(TestComponent);
      fixture.detectChanges();

      component = fixture.componentInstance;
      debugElement = fixture.debugElement.query(By.css('bci-commandbar-button'));
      button = debugElement.injector.get(CommandbarButtonComponent);
    })
  );

  it('should create', () => {
    expect(component).toBeTruthy();
  });

  it('should have icon set', () => {
    expect(button.icon).toEqual('bosch-ic-add');
  });
});
