define(["require", "exports", "./button.controller"], function (require, exports, button_controller_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    describe('ButtonController', function () {
        var ctrl, $window;
        beforeEach(function () {
            $window = {
                location: {
                    href: null
                }
            };
            ctrl = new button_controller_1.ButtonController($window, setTimeout.bind(window));
        });
        it('Should open a link when link is set', function () {
            var link = 'http://google.de';
            ctrl.link = link;
            ctrl.clickHandler();
            expect($window.location.href).toBe(link);
        });
        it('If mode is optimistic and no link is given, it should be disabled and change color and icon', function () {
            ctrl.optimistic = 'true';
            ctrl.clickHandler();
            expect(ctrl.disabled).toBe(true);
            expect(ctrl.color).toBe(button_controller_1.OPTIMISTIC_COLOR);
            expect(ctrl.icon).toBe(button_controller_1.OPTIMISTIC_ICON);
        });
        it("Should reset the state to inital-one after " + button_controller_1.RESET_DELAY + "ms", function (done) {
            ctrl.optimistic = 'true';
            var iconBefore = ctrl.icon;
            var colorBefore = ctrl.color;
            var disabledBefore = ctrl.disabled;
            ctrl.clickHandler();
            setTimeout(function () {
                expect(ctrl.icon).toBe(iconBefore);
                expect(ctrl.color).toBe(colorBefore);
                expect(ctrl.disabled).toBe(disabledBefore);
                done();
            }, ctrl.resetDelay + 500);
        });
    });
});
//# sourceMappingURL=button.controller.spec.js.map