This repository has been archived by the owner on May 13, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for mjs_extended_scope manifest member
- Loading branch information
mrodriguez
committed
Nov 20, 2015
1 parent
831e57d
commit eabaacc
Showing
9 changed files
with
99 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
lib/manifestTools/validationRules/all/accessRulesDeprecated.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
var validationConstants = require('../../validationConstants'); | ||
|
||
module.exports = function (manifestContent, callback) { | ||
if (manifestContent.mjs_access_whitelist) { | ||
return callback(undefined, { | ||
'description': 'The mjs_access_whitelist member is deprecated and won\'t be supported in future versions. Use mjs_extended_scope instead', | ||
'platform': validationConstants.platforms.all, | ||
'level': validationConstants.levels.warning, | ||
'member': validationConstants.manifestMembers.mjs_access_whitelist, | ||
'code': validationConstants.codes.deprecatedMember | ||
}); | ||
} | ||
|
||
callback(); | ||
}; |
20 changes: 20 additions & 0 deletions
20
lib/manifestTools/validationRules/all/extendedScopeRequired.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
var validationConstants = require('../../validationConstants'); | ||
|
||
module.exports = function (manifestContent, callback) { | ||
var mjs_access_whitelist = manifestContent.mjs_access_whitelist; | ||
var mjs_extended_scope = manifestContent.mjs_extended_scope; | ||
if ((!mjs_access_whitelist || !(mjs_access_whitelist instanceof Array) || mjs_access_whitelist.length === 0) && | ||
(!mjs_extended_scope || !(mjs_extended_scope instanceof Array) || mjs_extended_scope.length === 0)) { | ||
return callback(undefined, { | ||
'description': 'It is recommended to specify a set of rules that represent the navigation scope of the application', | ||
'platform': validationConstants.platforms.all, | ||
'level': validationConstants.levels.suggestion, | ||
'member': validationConstants.manifestMembers.mjs_extended_scope, | ||
'code': validationConstants.codes.requiredValue | ||
}); | ||
} | ||
|
||
callback(); | ||
}; |
18 changes: 0 additions & 18 deletions
18
lib/manifestTools/validationRules/all/requiredAccessRules.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
test/manifestTools/validations/all/accessRulesDeprecated.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
var validation = require('../../../../lib/manifestTools/validationRules/all/accessRulesDeprecated'); | ||
var validationConstants = require('../../../../lib/manifestTools/validationConstants'); | ||
var should = require('should'); | ||
|
||
describe('Validation - All', function () { | ||
describe('deprecatedAccessRules', function () { | ||
it('Should return a \'deprecated\' warning if manifest defines access rules', function(done) { | ||
validation({ mjs_access_whitelist: ['test'] }, function(err, warning) { | ||
should.not.exist(err); | ||
should.exist(warning); | ||
warning.should.have.property('platform', validationConstants.platforms.all); | ||
warning.should.have.property('level', validationConstants.levels.warning); | ||
warning.should.have.property('member', validationConstants.manifestMembers.mjs_access_whitelist); | ||
warning.should.have.property('code', validationConstants.codes.deprecatedMember); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should not return a warning if manifest access rules is not defined', function(done) { | ||
validation({}, function(err, warning) { | ||
should.not.exist(err); | ||
should.not.exist(warning); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
24 changes: 12 additions & 12 deletions
24
...ls/validations/all/requiredAccessRules.js → .../validations/all/extendedScopeRequired.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters