medialize/ally.js

View on GitHub
test/unit/is.focus-relevant.test.js

Summary

Maintainability
F
1 wk
Test Coverage

File is.focus-relevant.test.js has 267 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.focus-relevant.test.js - About 2 hrs to fix

    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(isFocusRelevant(element)).to.equal(false);
          });
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 1 other location - About 1 day to fix
    test/unit/is.focusable.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(isFocusRelevant(element)).to.equal(true);
          });
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 4 other locations - About 1 day to fix
    test/unit/is.focusable.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.focus-relevant.test.js and 2 other locations - About 1 day to fix
    test/unit/is.focusable.test.js on lines 337..363
    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(isFocusRelevant(document)).to.equal(false);
          });
    
    
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 5 other locations - About 7 hrs to fix
    test/unit/is.focusable.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(isFocusRelevant(element)).to.equal(false);
          });
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 3 other locations - About 7 hrs to fix
    test/unit/is.focusable.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.focus-relevant.test.js and 3 other locations - About 7 hrs to fix
    test/unit/is.focusable.test.js on lines 255..272
    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(isFocusRelevant(element)).to.equal(true);
          });
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 1 other location - About 5 hrs to fix
    test/unit/is.focusable.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 <area>', function() {
          bdd.it('should return true for <area>', function() {
            var element = document.getElementById('image-map-area');
            expect(isFocusRelevant(element)).to.equal(true);
          });
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 1 other location - About 5 hrs to fix
    test/unit/is.only-tabbable.test.js on lines 169..180

    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 139.

    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(isFocusRelevant(element)).to.equal(supports.focusObjectSvg);
          });
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 1 other location - About 5 hrs to fix
    test/unit/is.focusable.test.js on lines 243..253

    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(isFocusRelevant(element)).to.equal(true);
          });
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 1 other location - About 4 hrs to fix
    test/unit/is.focusable.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(isFocusRelevant.rules({
            context: element,
          })).to.equal(false, '.rules()');
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 4 other locations - About 3 hrs to fix
    test/unit/is.focusable.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 5 locations. Consider refactoring.
    Open

        bdd.it('should handle invalid input', function() {
          expect(function() {
            isFocusRelevant(null);
          }).to.throw(TypeError, 'is/focus-relevant requires valid options.context');
    
    
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 4 other locations - About 2 hrs to fix
    test/unit/is.focusable.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 3 locations. Consider refactoring.
    Open

          bdd.it('should return {browser-specific} for <svg tabindex="-1">', function() {
            var element = document.getElementById('svg');
            element.setAttribute('tabindex', '-1');
            expect(isFocusRelevant(element)).to.equal(supports.focusSvg || supports.focusSvgTabindexAttribute);
          });
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 2 other locations - About 2 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 152..156
    test/unit/is.tabbable.test.js on lines 239..243

    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 79.

    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.it('should return {browser-specific} for <img usemap="…" tabindex="-1">', function() {
            var element = document.getElementById('img-usemap');
            element.setAttribute('tabindex', '-1');
            expect(isFocusRelevant(element)).to.equal(supports.focusRedirectImgUsemap || supports.focusImgUsemapTabindex);
          });
    Severity: Major
    Found in test/unit/is.focus-relevant.test.js and 2 other locations - About 2 hrs to fix
    test/unit/is.focus-relevant.test.js on lines 214..218
    test/unit/is.tabbable.test.js on lines 239..243

    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 79.

    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.focus-relevant.test.js and 6 other locations - About 1 hr to fix
    test/unit/is.focusable.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!bdd'. Do not use import syntax to configure webpack loaders.
    Open

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

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

    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.focus-relevant.test.js by eslint

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

    There are no issues that match your filters.

    Category
    Status