1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-22 15:28:49 -05:00

fix write ctrl

This commit is contained in:
Felix Hammerl 2013-12-04 16:33:10 +01:00
parent 9337272b3a
commit 82ee9a3ed8
2 changed files with 26 additions and 10 deletions

View File

@ -189,7 +189,7 @@ define(function(require) {
$scope.replyTo.answered = true; $scope.replyTo.answered = true;
// mark remote imap object // mark remote imap object
emailDao.imapMarkAnswered({ emailDao.markAnswered({
uid: $scope.replyTo.uid, uid: $scope.replyTo.uid,
folder: $scope.state.nav.currentFolder.path folder: $scope.state.nav.currentFolder.path
}, $scope.onError); }, $scope.onError);

View File

@ -165,21 +165,37 @@ define(function(require) {
describe('send to outbox', function() { describe('send to outbox', function() {
it('should work', function(done) { it('should work', function(done) {
scope.state.writer.open = true; var verifyToSpy = sinon.spy(scope, 'verifyTo'),
scope.to = 'a, b, c'; re = {
scope.body = 'asd'; from: [{
scope.subject = 'yaddablabla'; address: 'pity@dafool'
scope.toKey = 'Public Key'; }],
subject: 'Ermahgerd!',
sentDate: new Date(),
body: 'so much body!'
};
emailDaoMock.store.withArgs(sinon.match(function(mail) { scope.state.nav = {
return mail.from[0].address === emailAddress && mail.to.length === 3; currentFolder: 'currentFolder'
})).yieldsAsync(); };
scope.emptyOutbox = function() {
scope.emptyOutbox = function() {};
emailDaoMock.store.yields();
emailDaoMock.markAnswered.yields();
scope.onError = function(err) {
expect(err).to.not.exist;
expect(scope.state.writer.open).to.be.false; expect(scope.state.writer.open).to.be.false;
expect(emailDaoMock.store.calledOnce).to.be.true; expect(emailDaoMock.store.calledOnce).to.be.true;
expect(emailDaoMock.store.calledOnce).to.be.true;
expect(verifyToSpy.calledOnce).to.be.true;
scope.verifyTo.restore();
done(); done();
}; };
scope.state.writer.write(re);
scope.sendToOutbox(); scope.sendToOutbox();
}); });