medialize/ally.js

View on GitHub
test/unit/is.focusable.test.js

Summary

Maintainability
F
1 wk
Test Coverage

File is.focusable.test.js has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

define(function(require) {
  'use strict';

  var bdd = require('intern!bdd');
  var expect = require('intern/chai!expect');
Severity: Minor
Found in test/unit/is.focusable.test.js - About 3 hrs to fix

    Unexpected mix of '&&' and '||'.
    Open

            expect(isFocusable(element)).to.equal(supports.focusingSvgElements && supports.focusSvg || supports.focusSvgTabindexAttribute);
    Severity: Minor
    Found in test/unit/is.focusable.test.js by eslint

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Unexpected mix of '&&' and '||'.
    Open

            expect(isFocusable(element)).to.equal(supports.focusingSvgElements && supports.focusSvg || supports.focusSvgTabindexAttribute);
    Severity: Minor
    Found in test/unit/is.focusable.test.js by eslint

    Disallow mixes of different operators (no-mixed-operators)

    Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable. This rule warns when different operators are used consecutively without parentheses in an expression.

    var foo = a && b || c || d;    /*BAD: Unexpected mix of '&&' and '||'.*/
    var foo = (a && b) || c || d;  /*GOOD*/
    var foo = a && (b || c || d);  /*GOOD*/

    Rule Details

    This rule checks BinaryExpression and LogicalExpression.

    This rule may conflict with [no-extra-parens](no-extra-parens.md) rule. If you use both this and [no-extra-parens](no-extra-parens.md) rule together, you need to use the nestedBinaryExpressions option of [no-extra-parens](no-extra-parens.md) rule.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a + b * c;

    Examples of correct code for this rule:

    /*eslint no-mixed-operators: "error"*/
    
    var foo = a || b || c;
    var foo = a && b && c;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 || c > 0 || d + 1 === 0);
    var foo = a + (b * c);
    var foo = (a + b) * c;

    Options

    {
        "no-mixed-operators": [
            "error",
            {
                "groups": [
                    ["+", "-", "*", "/", "%", "**"],
                    ["&", "|", "^", "~", "<<", ">>", ">>>"],
                    ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
                    ["&&", "||"],
                    ["in", "instanceof"]
                ],
                "allowSamePrecedence": true
            }
        ]
    }

    This rule has 2 options.

    • groups (string[][]) - specifies groups to compare operators. When this rule compares two operators, if both operators are included in a same group, this rule checks it. Otherwise, this rule ignores it. This value is a list of groups. The group is a list of binary operators. Default is the groups for each kind of operators.
    • allowSamePrecedence (boolean) - specifies to allow mix of 2 operators if those have the same precedence. Default is true.

    groups

    The following operators can be used in groups option:

    • Arithmetic Operators: "+", "-", "*", "/", "%", "**"
    • Bitwise Operators: "&", "|", "^", "~", "<<", ">>", ">>>"
    • Comparison Operators: "==", "!=", "===", "!==", ">", ">=", "<", "<="
    • Logical Operators: "&&", "||"
    • Relational Operators: "in", "instanceof"

    Now, considers about {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} configure. This configure has 2 groups: bitwise operators and logical operators. This rule checks only if both operators are included in a same group. So, in this case, this rule comes to check between bitwise operators and between logical operators. This rule ignores other operators.

    Examples of incorrect code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a && b < 0 || c > 0 || d + 1 === 0;
    var foo = a & b | c;

    Examples of correct code for this rule with {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]} option:

    /*eslint no-mixed-operators: ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}]*/
    
    var foo = a || b > 0 || c + 1 === 0;
    var foo = a && b > 0 && c + 1 === 0;
    var foo = (a && b < 0) || c > 0 || d + 1 === 0;
    var foo = a && (b < 0 ||  c > 0 || d + 1 === 0);
    var foo = (a & b) | c;
    var foo = a & (b | c);
    var foo = a + b * c;
    var foo = a + (b * c);
    var foo = (a + b) * c;

    allowSamePrecedence

    Examples of correct code for this rule with {"allowSamePrecedence": true} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": true}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    Examples of incorrect code for this rule with {"allowSamePrecedence": false} option:

    /*eslint no-mixed-operators: ["error", {"allowSamePrecedence": false}]*/
    
    // + and - have the same precedence.
    var foo = a + b - c;

    When Not To Use It

    If you don't want to be notified about mixed operators, then it's safe to disable this rule.

    Related Rules

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        bdd.describe('for <div> with tabindex attribute', function() {
          bdd.it('should return false for <div>', function() {
            var element = document.getElementById('inert-div');
            expect(isFocusable(element)).to.equal(false);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 1 other location - About 1 day to fix
    test/unit/is.focus-relevant.test.js on lines 62..87

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 296.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        bdd.describe('for <input>', function() {
          bdd.it('should return true for <input>', function() {
            var element = document.getElementById('input');
            expect(isFocusable(element)).to.equal(true);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 4 other locations - About 1 day to fix
    test/unit/is.focus-relevant.test.js on lines 106..131
    test/unit/is.only-tabbable.test.js on lines 68..93
    test/unit/is.only-tabbable.test.js on lines 112..137
    test/unit/is.tabbable.test.js on lines 114..139

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 292.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        bdd.describe('for ShadowDOM', function() {
          var host;
          var root;
    
          bdd.before(function() {
    Severity: Major
    Found in test/unit/is.focusable.test.js and 2 other locations - About 1 day to fix
    test/unit/is.focus-relevant.test.js on lines 301..327
    test/unit/is.only-tabbable.test.js on lines 307..333

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 213.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

        bdd.describe('for document structure', function() {
          bdd.it('should return false for document', function() {
            expect(isFocusable(document)).to.equal(false);
          });
    
    
    Severity: Major
    Found in test/unit/is.focusable.test.js and 5 other locations - About 7 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 44..60
    test/unit/is.only-tabbable.test.js on lines 50..66
    test/unit/is.shadowed.test.js on lines 27..43
    test/unit/is.tabbable.test.js on lines 52..68
    test/unit/is.valid-tabindex.test.js on lines 38..54

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 189.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        bdd.describe('for <a>', function() {
          bdd.it('should return false for <a> (without href attribute)', function() {
            var element = document.getElementById('anchor');
            expect(isFocusable(element)).to.equal(false);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 3 other locations - About 7 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 89..104
    test/unit/is.only-tabbable.test.js on lines 95..110
    test/unit/is.only-tabbable.test.js on lines 268..283

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 182.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        bdd.describe('for <embed>', function() {
          bdd.before(function() {
            var element = document.getElementById('embed');
            if (!element) {
              this.skip('skipping to avoid test colliding with QuickTime');
    Severity: Major
    Found in test/unit/is.focusable.test.js and 3 other locations - About 7 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 243..260
    test/unit/is.only-tabbable.test.js on lines 249..266
    test/unit/is.tabbable.test.js on lines 280..297

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 178.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        bdd.describe('for editable elements', function() {
          bdd.it('should return true for <span contenteditable>', function() {
            var element = document.getElementById('span-contenteditable');
            expect(isFocusable(element)).to.equal(true);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 1 other location - About 5 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 133..144

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 150.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        bdd.describe('for <object>', function() {
          bdd.it('should return {browser-specific} for <object> referencing an SVG', function() {
            var element = document.getElementById('object-svg');
            expect(isFocusable(element)).to.equal(supports.focusObjectSvg);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 1 other location - About 5 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 231..241

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 135.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        bdd.describe('for <audio>', function() {
          bdd.it('should return true for <audio controls>', function() {
            var element = document.getElementById('audio-controls');
            expect(isFocusable(element)).to.equal(true);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 1 other location - About 4 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 196..206

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 131.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        bdd.it('should provide .rules() and .except()', function() {
          var element = document.getElementById('inert-div');
          expect(isFocusable.rules({
            context: element,
          })).to.equal(false, '.rules()');
    Severity: Major
    Found in test/unit/is.focusable.test.js and 4 other locations - About 3 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 35..42
    test/unit/is.only-tabbable.test.js on lines 41..48
    test/unit/is.tabbable.test.js on lines 43..50
    test/unit/is.visible.test.js on lines 100..107

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 103.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

          bdd.it('should return false for flexbox container with except.flexbox', function() {
            var element = document.getElementById('flexbox-parent');
            var result = isFocusable.rules({
              context: element,
              except: {
    Severity: Major
    Found in test/unit/is.focusable.test.js and 3 other locations - About 2 hrs to fix
    test/unit/is.focusable.test.js on lines 225..235
    test/unit/is.focusable.test.js on lines 290..300
    test/unit/is.tabbable.test.js on lines 315..325

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

          bdd.it('should return true for <a xlink:href="…"> with except.onlyTabbable', function() {
            var element = document.getElementById('svg-link');
            var result = isFocusable.rules({
              context: element,
              except: {
    Severity: Major
    Found in test/unit/is.focusable.test.js and 3 other locations - About 2 hrs to fix
    test/unit/is.focusable.test.js on lines 290..300
    test/unit/is.focusable.test.js on lines 324..334
    test/unit/is.tabbable.test.js on lines 315..325

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

          bdd.it('should return false for scrollable elements with except.scrollable', function() {
            var element = document.getElementById('scroll-container');
            var result = isFocusable.rules({
              context: element,
              except: {
    Severity: Major
    Found in test/unit/is.focusable.test.js and 3 other locations - About 2 hrs to fix
    test/unit/is.focusable.test.js on lines 225..235
    test/unit/is.focusable.test.js on lines 324..334
    test/unit/is.tabbable.test.js on lines 315..325

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        bdd.it('should handle invalid input', function() {
          expect(function() {
            isFocusable(null);
          }).to.throw(TypeError, 'is/focusable requires valid options.context');
    
    
    Severity: Major
    Found in test/unit/is.focusable.test.js and 4 other locations - About 2 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 25..33
    test/unit/is.only-tabbable.test.js on lines 31..39
    test/unit/is.tabbable.test.js on lines 33..41
    test/unit/is.visible.test.js on lines 90..98

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

          bdd.it('should return {browser-specific} for <img usemap="…" tabindex="-1">', function() {
            var element = document.getElementById('img-usemap');
            element.setAttribute('tabindex', '-1');
            expect(isFocusable(element)).to.equal(supports.focusImgUsemapTabindex);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 4 other locations - About 1 hr to fix
    test/unit/is.focusable.test.js on lines 170..174
    test/unit/is.focusable.test.js on lines 183..187
    test/unit/is.focusable.test.js on lines 189..193
    test/unit/is.tabbable.test.js on lines 214..218

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 71.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

          bdd.it('should return {browser-specific} for <label tabindex="0">', function() {
            var element = document.getElementById('label');
            element.setAttribute('tabindex', '0');
            expect(isFocusable(element)).to.equal(supports.focusLabelTabindex);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 4 other locations - About 1 hr to fix
    test/unit/is.focusable.test.js on lines 152..156
    test/unit/is.focusable.test.js on lines 170..174
    test/unit/is.focusable.test.js on lines 183..187
    test/unit/is.tabbable.test.js on lines 214..218

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 71.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

          bdd.it('should return {browser-specific} for <area tabindex="-1">', function() {
            var element = document.getElementById('image-map-area');
            element.setAttribute('tabindex', '-1');
            expect(isFocusable(element)).to.equal(supports.focusAreaTabindex);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 4 other locations - About 1 hr to fix
    test/unit/is.focusable.test.js on lines 152..156
    test/unit/is.focusable.test.js on lines 183..187
    test/unit/is.focusable.test.js on lines 189..193
    test/unit/is.tabbable.test.js on lines 214..218

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 71.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

          bdd.it('should return {browser-specific} for <label tabindex="-1">', function() {
            var element = document.getElementById('label');
            element.setAttribute('tabindex', '-1');
            expect(isFocusable(element)).to.equal(supports.focusLabelTabindex);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 4 other locations - About 1 hr to fix
    test/unit/is.focusable.test.js on lines 152..156
    test/unit/is.focusable.test.js on lines 170..174
    test/unit/is.focusable.test.js on lines 189..193
    test/unit/is.tabbable.test.js on lines 214..218

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 71.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          bdd.it('should return {browser-specific} for <svg>', function() {
            var element = document.getElementById('svg');
            expect(isFocusable(element)).to.equal(supports.focusingSvgElements && supports.focusSvg);
          });
    Severity: Major
    Found in test/unit/is.focusable.test.js and 1 other location - About 1 hr to fix
    test/unit/is.tabbable.test.js on lines 234..237

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

        bdd.before(function() {
          var deferred = this.async(10000);
          fixture = focusableFixture();
          // NOTE: Firefox decodes DataURIs asynchronously
          setTimeout(deferred.resolve, 200);
    Severity: Major
    Found in test/unit/is.focusable.test.js and 6 other locations - About 1 hr to fix
    test/unit/is.focus-relevant.test.js on lines 13..18
    test/unit/is.tabbable.test.js on lines 21..26
    test/unit/query.focusable.all.test.js on lines 14..19
    test/unit/query.focusable.strict.test.js on lines 14..19
    test/unit/query.focusable.test.js on lines 15..20
    test/unit/query.tabbable.test.js on lines 14..19

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 57.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Unexpected '!' in 'intern/chai!expect'. Do not use import syntax to configure webpack loaders.
    Open

      var expect = require('intern/chai!expect');
    Severity: Minor
    Found in test/unit/is.focusable.test.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Unexpected '!' in 'intern!bdd'. Do not use import syntax to configure webpack loaders.
    Open

      var bdd = require('intern!bdd');
    Severity: Minor
    Found in test/unit/is.focusable.test.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status