mirror of
https://github.com/moparisthebest/mail
synced 2024-10-31 15:25:01 -04:00
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
var DialogCtrl = require('../../../../src/js/controller/app/dialog');
|
|
|
|
describe('Dialog Controller unit test', function() {
|
|
var scope, dialogCtrl, dialogService;
|
|
|
|
beforeEach(function() {
|
|
angular.module('dialogtest', ['woUtil']);
|
|
angular.mock.module('dialogtest');
|
|
angular.mock.inject(function($rootScope, $controller, dialog) {
|
|
scope = $rootScope.$new();
|
|
scope.state = {
|
|
dialog: {}
|
|
};
|
|
dialogService = dialog;
|
|
dialogCtrl = $controller(DialogCtrl, {
|
|
$scope: scope,
|
|
dialog: dialog
|
|
});
|
|
});
|
|
});
|
|
|
|
afterEach(function() {});
|
|
|
|
describe('confirm', function() {
|
|
it('should work', function(done) {
|
|
scope.callback = function(confirmed) {
|
|
expect(confirmed).to.be.true;
|
|
expect(scope.open).to.be.false;
|
|
done();
|
|
};
|
|
scope.confirm(true);
|
|
});
|
|
});
|
|
|
|
describe('cancel', function() {
|
|
it('should work', function(done) {
|
|
scope.callback = function(confirmed) {
|
|
expect(confirmed).to.be.false;
|
|
expect(scope.open).to.be.false;
|
|
done();
|
|
};
|
|
scope.confirm(false);
|
|
});
|
|
});
|
|
}); |