mirror of
https://github.com/moparisthebest/mail
synced 2024-11-14 05:05:10 -05:00
50 lines
1.5 KiB
JavaScript
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);
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
});
|