import { ButtonComponent } from './button.component';
import { EasyTest, easyTest } from 'ngx-easy-test';
describe('ButtonComponent', () => {
type Context = EasyTest<ButtonComponent>;
easyTest(ButtonComponent);
it('should set the "success" class by default', function ( this : Context ) {
expect(this.query('button')).toHaveClass('success');
});
it('should set the class name according to the [className]', function ( this : Context ) {
this.whenInput({ className: 'danger' });
expect(this.query('button')).toHaveClass('danger');
expect(this.query('button')).not.toHaveClass('success');
});
it('should set the title according to the [title]', function ( this : Context ) {
this.whenInput('title', 'Click');
expect(this.query('button')).toContainText('Click');
});
it('should emit the $event on click', function ( this : Context ) {
let output;
this.whenOutput<{ type: string }>('click', result => output = result);
this.trigger('click', 'button', { type: 'click' });
expect(output).toEqual({ type: 'click' });
});
});