1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-26 19:02:20 -05:00
mail/test/unit/dialog-ctrl-test.js
2014-06-23 17:21:02 +02:00

50 lines
1.5 KiB
JavaScript

define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
DialogCtrl = require('js/controller/dialog');
describe('Dialog Controller unit test', function() {
var scope, dialogCtrl;
beforeEach(function() {
angular.module('dialogtest', []);
mocks.module('dialogtest');
mocks.inject(function($rootScope, $controller) {
scope = $rootScope.$new();
scope.state = {
dialog: {}
};
dialogCtrl = $controller(DialogCtrl, {
$scope: scope
});
});
});
afterEach(function() {});
describe('confirm', function() {
it('should work', function(done) {
scope.state.dialog.callback = function(confirmed) {
expect(confirmed).to.be.true;
expect(scope.state.dialog.open).to.be.false;
done();
};
scope.confirm(true);
});
});
describe('cancel', function() {
it('should work', function(done) {
scope.state.dialog.callback = function(confirmed) {
expect(confirmed).to.be.false;
expect(scope.state.dialog.open).to.be.false;
done();
};
scope.confirm(false);
});
});
});
});