Skip to content
Snippets Groups Projects
Commit ded2b2b6 authored by Lukas Reschke's avatar Lukas Reschke
Browse files

Merge pull request #17353 from owncloud/apps-keepgloballist

Fix global app list state
parents a3df41dd d5b7e40c
No related branches found
No related tags found
No related merge requests found
......@@ -86,11 +86,12 @@ OC.Settings.Apps = OC.Settings.Apps || {
}), {
type:'GET',
success: function (apps) {
var appList = _.map(_.indexBy(apps.apps, 'id'), function(app) {
var appListWithIndex = _.indexBy(apps.apps, 'id');
OC.Settings.Apps.State.apps = appListWithIndex;
var appList = _.map(appListWithIndex, function(app) {
// default values for missing fields
return _.extend({level: 0}, app);
});
OC.Settings.Apps.State.apps = appList;
var source = $("#app-template").html();
var template = Handlebars.compile(source);
......
......@@ -159,6 +159,32 @@ describe('OC.Settings.Apps tests', function() {
var results = getResultsFromDom();
expect(results.length).toEqual(5);
expect(results).toEqual(['alpha', 'delta', 'zork', 'foo', 'nolevel']);
expect(OC.Settings.Apps.State.apps).toEqual({
'foo': {
id: 'foo',
name: 'Foo app',
level: 0
},
'alpha': {
id: 'alpha',
name: 'Alpha app',
level: 300
},
'nolevel': {
id: 'nolevel',
name: 'No level'
},
'zork': {
id: 'zork',
name: 'Some famous adventure game',
level: 200
},
'delta': {
id: 'delta',
name: 'Mathematical symbol',
level: 200
}
});
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment