Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
name: 'app',
out: '../js/mail.min.js',
insertRequire: [
'app',
'notification'
'init',
]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @skjnldsv: I fixed another occurrence of that bloody module. I knew it was loaded twice, but I couldn't find it when I fix the other one…

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

God dammit! You again Mr notification! I was expecting you!

})
5 changes: 0 additions & 5 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,5 @@ define(function(require) {
})(), 1000);
});

$(function() {
// Start app when the page is ready
Mail.start();
});

return Mail;
});
28 changes: 28 additions & 0 deletions js/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
*
* Mail
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

define(function(require) {
var App = require('app');

$(function() {
// Start app when the page is ready
console.log('Starting Mail …');
App.start();
});
});
2 changes: 1 addition & 1 deletion js/require_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
});

require([
'app'
'init'
]);
})();
97 changes: 97 additions & 0 deletions js/tests/integration/app_start_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/**
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
*
* Mail
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

define([
'app',
'cache',
'radio',
'backbone',
'controller/accountcontroller',
'models/accountcollection'
], function(Mail, Cache, Radio, Backbone, AccountController,
AccountCollection) {
describe('App', function() {

beforeEach(function() {
jasmine.Ajax.install();
$('testcontainer').remove();
$('body')
.append('testcontainer')
.append(
'<input type="hidden" id="config-installed-version" value="0.6.1">'
+ '<input type="hidden" id="serialized-accounts" value="">'
+ '<div id="user-displayname">Jane Doe</div>'
+ '<div id="user-email">jane@doe.cz</div>'
+ '<div id="app">'
+ ' <div id="app-navigation" class="icon-loading">'
+ ' <div id="mail-new-message-fixed"></div>'
+ ' <ul>'
+ ' <li id="app-navigation-accounts"></li>'
+ ' </ul>'
+ ' <div id="app-settings">'
+ ' <div id="app-settings-header">'
+ ' <button class="settings-button" data-apps-slide-toggle="#app-settings-content"></button>'
+ ' </div>'
+ ' <div id="app-settings-content"></div>'
+ ' </div>'
+ ' </div>'
+ ' <div id="app-content">'
+ ' <div class="mail-content container">'
+ ' <div class="container icon-loading"></div>'
+ ' </div>'
+ ' </div>'
+ '</div>');
});

afterEach(function() {
jasmine.Ajax.uninstall();
});

it('starts', function() {
var accountsDeferred = $.Deferred();

spyOn(Cache, 'init');
spyOn(Radio.ui, 'trigger');
spyOn(Backbone.history, 'start');
spyOn(AccountController, 'loadAccounts').and.callFake(function() {
return accountsDeferred.promise();
});

// No ajax calls so far
expect(jasmine.Ajax.requests.count()).toBe(0);

// Let's go…
Mail.start();

expect(Cache.init).toHaveBeenCalled();
expect(Radio.ui.trigger).toHaveBeenCalledWith('content:loading');

var accounts = new AccountCollection([
{
accountId: 44,
name: 'Jane Doe',
email: 'jane@doe.se'
}
]);
accountsDeferred.resolve(accounts);

expect(Backbone.history.start).toHaveBeenCalled();
});
});
});
15 changes: 8 additions & 7 deletions js/tests/service_accountservice_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ define([
'radio',
], function(AccountService, OC, Radio) {

beforeEach(function() {
jasmine.Ajax.install();
});
describe('AccountService', function() {

afterEach(function() {
jasmine.Ajax.uninstall();
});
beforeEach(function() {
jasmine.Ajax.install();
});

afterEach(function() {
jasmine.Ajax.uninstall();
});

describe('AccountService', function() {
it('creates a new account on the server', function() {
spyOn(OC, 'generateUrl').and.returnValue('index.php/apps/mail/accounts');

Expand Down
12 changes: 12 additions & 0 deletions js/tests/test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ OC = {
}
};

SearchProxy = {
attach: function(search) {

},
filterProxy: function(query) {

},
setFilter: function(newFilter) {

}
};

// jQuery module stubs
$.fn.tooltip = function() {

Expand Down