Merge pull request #17353 from owncloud/apps-keepgloballist
Fix global app list state
This commit is contained in:
commit
ded2b2b690
2 changed files with 29 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue