import ExpanderController from './expander.controller';

describe('wsExpanderController', () => {
  let controller;

  beforeEach(() => {
    controller = new ExpanderController();
    controller.$onInit();
  });

  it('is collapsed initially', () => {
    expect(controller.isExpanded()).toBe(false);
  });

  it('expands and collapses when toggled', () => {
    controller.toggle();
    expect(controller.isExpanded()).toBe(true);

    controller.toggle();
    expect(controller.isExpanded()).toBe(false);
  });

  it('changes the button text when toggled', () => {
    controller.showText = 'ohai';
    controller.hideText = 'kthxbai';

    expect(controller.getToggleText()).toBe('ohai');

    controller.toggle();
    expect(controller.getToggleText()).toBe('kthxbai');

    controller.toggle();
    expect(controller.getToggleText()).toBe('ohai');
  });
});
