Repository: rwjblue/ember-template-lint (js)

Issue:
invalid-interactive additionalInteractiveTags not working?
I have this:

```<form {{action 'foo' on="submit"}}>```

and its failing the invalid-interactive check.  We don't have buttons in the form, but we want to be able to submit the form with the enter key for accessibility.  It seems like it should be okay for forms to submit actions...

I still think its odd to default forms to fail this check.  I'm trying to change this behavior with this rule and it doesn't seem to be working:

        'invalid-interactive': {additionalInteractiveTags:['form']},

when looking at 'lint-invalid-interactive.js' it doesn't appear to be using additionalInteractiveTags like 'lint-nested-interactive.js' is...

Pull request:
[BUGFIX] Honor `additionalInteractiveTags` option in `invalid-interactive` rule
Closes #101

Patch:
diff --git a/lib/rules/lint-invalid-interactive.js b/lib/rules/lint-invalid-interactive.js
index b9b385b..847060d 100644
--- a/lib/rules/lint-invalid-interactive.js
+++ b/lib/rules/lint-invalid-interactive.js
@@ -11,12 +11,23 @@ module.exports = function(addonContext) {
     return parseConfig(this.ruleName, config);
   };
 
+  InvalidInteractive.prototype.isCustomInteractiveElement = function(node) {
+    var additionalInteractiveTags = this.config.additionalInteractiveTags || [];
+
+    if (additionalInteractiveTags.indexOf(node.tag) > -1) {
+      return true;
+    } else {
+      return false;
+    }
+  };
+
   InvalidInteractive.prototype.visitors = function() {
     this._element = null;
 
     var visitor = {
       enter: function(node) {
-        this._element = !isInteractiveElement(node) ? node : null;
+        var isInteractive = isInteractiveElement(node) || this.isCustomInteractiveElement(node);
+        this._element = !isInteractive ? node : null;
       },
 
       exit: function(node) {


Test patch:
diff --git a/test/unit/rules/lint-invalid-interactive-test.js b/test/unit/rules/lint-invalid-interactive-test.js
index 1361363..0074553 100644
--- a/test/unit/rules/lint-invalid-interactive-test.js
+++ b/test/unit/rules/lint-invalid-interactive-test.js
@@ -10,7 +10,15 @@ generateRuleTests({
   good: [
     '<button {{action "foo"}}></button>',
     '<div role="button" {{action "foo"}}></div>',
-    '<li><button {{action "foo"}}></button></li>'
+    '<li><button {{action "foo"}}></button></li>',
+    {
+      config: { additionalInteractiveTags: ['div'] },
+      template: '<div {{action "foo"}}></div>'
+    },
+    {
+      config: { additionalInteractiveTags: ['div'] },
+      template: '<div onclick={{action "foo"}}></div>'
+    }
   ],
 
   bad: [