-
Notifications
You must be signed in to change notification settings - Fork 363
Add support for config payload for AuditConfiguration #165
Add support for config payload for AuditConfiguration #165
Conversation
* Overwrite `AuditConfiguration` properties defined in the constructor with properties found in payload parameter. * Add test for new behaviour. * Add usage example in docs. * Fixes GoogleChrome#164
*/ | ||
axs.AuditConfiguration = function() { | ||
axs.AuditConfiguration = function(config) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! I like being able to pass a config object. Me gusta.
This is an exciting change, great work! LGTM |
@@ -78,6 +83,12 @@ axs.AuditConfiguration = function() { | |||
*/ | |||
this.showUnsupportedRulesWarning = true; | |||
|
|||
for (var prop in this) { | |||
if ((this.hasOwnProperty(prop)) && (prop in config)) { | |||
this[prop] = config[prop]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool, but is not going to work for severity
, ignoreSelectors
or ruleConfig
. We'll probably need to special case those.
@alice That's correct. That can be done but we have to determine a reasonable format for the data to pass to these methods in the config payload. It would probably be a good idea to merge this in first, and open an issue for automating these methods through config as well. |
@@ -22,8 +22,13 @@ goog.provide('axs.AuditConfiguration'); | |||
/** | |||
* Object to hold configuration for an Audit run. | |||
* @constructor | |||
* @param {?Object=} config Configuration object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add more detailed documentation for this, stating what can and cannot be configured this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
Looking forward to getting this merged! @loginx do you need an support on this? |
@ckundo I completely forgot about this. I thought it had been merged long ago. I'll have a look at this tonight as well. |
* Record typedefs don’t support optional attributes.
👍 go ahead and pull |
Add support for config payload for AuditConfiguration
AuditConfiguration
properties defined in the constructor with properties found in payload parameter.