capybara-accessible 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'rake'
4
+
3
5
  # Specify your gem's dependencies in capybara-praseodymium.gemspec
4
6
  gemspec
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Accessible
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
@@ -386,50 +386,7 @@ goog.base = function(a, b, c) {
386
386
  goog.scope = function(a) {
387
387
  a.call(goog.global)
388
388
  };
389
- var axs = {AuditResults:function() {
390
- this.errors_ = [];
391
- this.warnings_ = []
392
- }};
393
- goog.exportSymbol("axs.AuditResults", axs.AuditResults);
394
- axs.AuditResults.prototype.addError = function(a) {
395
- "" != a && this.errors_.push(a)
396
- };
397
- goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.prototype.addError);
398
- axs.AuditResults.prototype.addWarning = function(a) {
399
- "" != a && this.warnings_.push(a)
400
- };
401
- goog.exportProperty(axs.AuditResults.prototype, "addWarning", axs.AuditResults.prototype.addWarning);
402
- axs.AuditResults.prototype.numErrors = function() {
403
- return this.errors_.length
404
- };
405
- goog.exportProperty(axs.AuditResults.prototype, "numErrors", axs.AuditResults.prototype.numErrors);
406
- axs.AuditResults.prototype.numWarnings = function() {
407
- return this.warnings_.length
408
- };
409
- goog.exportProperty(axs.AuditResults.prototype, "numWarnings", axs.AuditResults.prototype.numWarnings);
410
- axs.AuditResults.prototype.getErrors = function() {
411
- return this.errors_
412
- };
413
- goog.exportProperty(axs.AuditResults.prototype, "getErrors", axs.AuditResults.prototype.getErrors);
414
- axs.AuditResults.prototype.getWarnings = function() {
415
- return this.warnings_
416
- };
417
- goog.exportProperty(axs.AuditResults.prototype, "getWarnings", axs.AuditResults.prototype.getWarnings);
418
- axs.AuditResults.prototype.toString = function() {
419
- for(var a = "", b = 0;b < this.errors_.length;b++) {
420
- 0 == b && (a += "\nErrors:\n");
421
- var c = this.errors_[b], a = a + (c + "\n\n")
422
- }
423
- for(b = 0;b < this.warnings_.length;b++) {
424
- 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n"
425
- }
426
- return a
427
- };
428
- goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.prototype.toString);
429
- axs.browserUtils = {};
430
- axs.browserUtils.matchSelector = function(a, b) {
431
- return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSelector(b)
432
- };
389
+ var axs = {};
433
390
  axs.constants = {};
434
391
  axs.constants.ARIA_ROLES = {alert:{namefrom:["author"], parent:["region"]}, alertdialog:{namefrom:["author"], namerequired:!0, parent:["alert", "dialog"]}, application:{namefrom:["author"], namerequired:!0, parent:["landmark"]}, article:{namefrom:["author"], parent:["document", "region"]}, banner:{namefrom:["author"], parent:["landmark"]}, button:{childpresentational:!0, namefrom:["contents", "author"], namerequired:!0, parent:["command"], properties:["aria-expanded", "aria-pressed"]}, checkbox:{namefrom:["contents",
435
392
  "author"], namerequired:!0, parent:["input"], requiredProperties:["aria-checked"], properties:["aria-checked"]}, columnheader:{namefrom:["contents", "author"], namerequired:!0, parent:["gridcell", "sectionhead", "widget"], properties:["aria-sort"]}, combobox:{mustcontain:["listbox", "textbox"], namefrom:["author"], namerequired:!0, parent:["select"], requiredProperties:["aria-expanded"], properties:["aria-expanded", "aria-autocomplete", "aria-required"]}, command:{"abstract":!0, namefrom:["author"],
@@ -512,7 +469,6 @@ for(var propertyName in axs.constants.ARIA_PROPERTIES) {
512
469
  }
513
470
  axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"};
514
471
  axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"};
515
- axs.constants.InlineElements = {TT:!0, I:!0, B:!0, BIG:!0, SMALL:!0, EM:!0, STRONG:!0, DFN:!0, CODE:!0, SAMP:!0, KBD:!0, VAR:!0, CITE:!0, ABBR:!0, ACRONYM:!0, A:!0, IMG:!0, OBJECT:!0, BR:!0, SCRIPT:!0, MAP:!0, Q:!0, SUB:!0, SUP:!0, SPAN:!0, BDO:!0, INPUT:!0, SELECT:!0, TEXTAREA:!0, LABEL:!0, BUTTON:!0};
516
472
  axs.utils = {};
517
473
  axs.utils.FOCUSABLE_ELEMENTS_SELECTOR = "input:not([type=hidden]):not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),a[href],iframe,[tabindex]";
518
474
  axs.utils.Color = function(a, b, c, d) {
@@ -529,26 +485,6 @@ axs.utils.calculateContrastRatio = function(a, b) {
529
485
  var c = axs.utils.calculateLuminance(a), d = axs.utils.calculateLuminance(b);
530
486
  return(Math.max(c, d) + 0.05) / (Math.min(c, d) + 0.05)
531
487
  };
532
- axs.utils.luminanceRatio = function(a, b) {
533
- return(Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05)
534
- };
535
- axs.utils.asElement = function(a) {
536
- switch(a.nodeType) {
537
- case Node.COMMENT_NODE:
538
- return null;
539
- case Node.ELEMENT_NODE:
540
- if("script" == a.tagName.toLowerCase()) {
541
- return null
542
- }
543
- break;
544
- case Node.TEXT_NODE:
545
- a = a.parentElement;
546
- break;
547
- default:
548
- return console.warn("Unhandled node type: ", a.nodeType), null
549
- }
550
- return a
551
- };
552
488
  axs.utils.elementIsTransparent = function(a) {
553
489
  return"0" == a.style.opacity
554
490
  };
@@ -596,13 +532,7 @@ axs.utils.isLargeFont = function(a) {
596
532
  a = "bold" == a.fontWeight;
597
533
  var c = b.match(/(\d+)px/);
598
534
  if(c) {
599
- b = parseInt(c[1], 10);
600
- if(c = window.getComputedStyle(document.body, null).fontSize.match(/(\d+)px/)) {
601
- var d = parseInt(c[1], 10), c = 1.2 * d, d = 1.5 * d
602
- }else {
603
- c = 19.2, d = 24
604
- }
605
- return a && b >= c || b >= d
535
+ return b = parseInt(c[1], 10), a && 19.2 <= b || 24 <= b ? !0 : !1
606
536
  }
607
537
  if(c = b.match(/(\d+)em/)) {
608
538
  return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1
@@ -662,115 +592,20 @@ axs.utils.parseColor = function(a) {
662
592
  }
663
593
  return(b = a.match(/^rgba\((\d+), (\d+), (\d+), (\d+(\.\d+)?)\)/)) ? (d = parseInt(b[4], 10), a = parseInt(b[1], 10), c = parseInt(b[2], 10), b = parseInt(b[3], 10), new axs.utils.Color(a, c, b, d)) : null
664
594
  };
665
- axs.utils.colorChannelToString = function(a) {
666
- return 15 >= a ? "0" + a.toString(16) : a.toString(16)
667
- };
668
595
  axs.utils.colorToString = function(a) {
669
- return 1 == a.alpha ? "#" + axs.utils.colorChannelToString(a.red) + axs.utils.colorChannelToString(a.green) + axs.utils.colorChannelToString(a.blue) : "rgba(" + [a.red, a.green, a.blue, a.alpha].join() + ")"
670
- };
671
- axs.utils.luminanceFromContrastRatio = function(a, b, c) {
672
- return c ? (a + 0.05) * b - 0.05 : (a + 0.05) / b - 0.05
673
- };
674
- axs.utils.translateColor = function(a, b) {
675
- var c = a[0], c = (b - c) / ((c > b ? 0 : 1) - c);
676
- return axs.utils.fromYCC([b, a[1] - a[1] * c, a[2] - a[2] * c])
677
- };
678
- axs.utils.suggestColors = function(a, b, c, d) {
679
- if(!axs.utils.isLowContrast(c, d, !0)) {
680
- return null
681
- }
682
- var e = {}, f = axs.utils.calculateLuminance(a), g = axs.utils.calculateLuminance(b), h = axs.utils.isLargeFont(d) ? 3 : 4.5, k = axs.utils.isLargeFont(d) ? 4.5 : 7, m = g > f, l = axs.utils.luminanceFromContrastRatio(f, h + 0.02, m), n = axs.utils.luminanceFromContrastRatio(f, k + 0.02, m), q = axs.utils.toYCC(b);
683
- if(axs.utils.isLowContrast(c, d, !1) && 1 >= l && 0 <= l) {
684
- var p = axs.utils.translateColor(q, l), l = axs.utils.calculateContrastRatio(p, a);
685
- axs.utils.calculateLuminance(p);
686
- f = {};
687
- f.fg = axs.utils.colorToString(p);
688
- f.bg = axs.utils.colorToString(a);
689
- f.contrast = l.toFixed(2);
690
- e.AA = f
691
- }
692
- axs.utils.isLowContrast(c, d, !0) && (1 >= n && 0 <= n) && (n = axs.utils.translateColor(q, n), l = axs.utils.calculateContrastRatio(n, a), f = {}, f.fg = axs.utils.colorToString(n), f.bg = axs.utils.colorToString(a), f.contrast = l.toFixed(2), e.AAA = f);
693
- h = axs.utils.luminanceFromContrastRatio(g, h + 0.02, !m);
694
- g = axs.utils.luminanceFromContrastRatio(g, k + 0.02, !m);
695
- a = axs.utils.toYCC(a);
696
- !("AA" in e) && (axs.utils.isLowContrast(c, d, !1) && 1 >= h && 0 <= h) && (k = axs.utils.translateColor(a, h), l = axs.utils.calculateContrastRatio(b, k), f = {}, f.bg = axs.utils.colorToString(k), f.fg = axs.utils.colorToString(b), f.contrast = l.toFixed(2), e.AA = f);
697
- !("AAA" in e) && (axs.utils.isLowContrast(c, d, !0) && 1 >= g && 0 <= g) && (c = axs.utils.translateColor(a, g), l = axs.utils.calculateContrastRatio(b, c), f = {}, f.bg = axs.utils.colorToString(c), f.fg = axs.utils.colorToString(b), f.contrast = l.toFixed(2), e.AAA = f);
698
- return e
596
+ return"rgba(" + [a.red, a.green, a.blue, a.alpha].join() + ")"
699
597
  };
700
598
  axs.utils.flattenColors = function(a, b) {
701
599
  var c = a.alpha;
702
600
  return new axs.utils.Color((1 - c) * b.red + c * a.red, (1 - c) * b.green + c * a.green, (1 - c) * b.blue + c * a.blue, 1)
703
601
  };
704
602
  axs.utils.calculateLuminance = function(a) {
705
- return axs.utils.toYCC(a)[0]
706
- };
707
- axs.utils.RGBToYCCMatrix = function(a, b) {
708
- return[[a, 1 - a - b, b], [-a / (2 - 2 * b), (a + b - 1) / (2 - 2 * b), (1 - b) / (2 - 2 * b)], [(1 - a) / (2 - 2 * a), (a + b - 1) / (2 - 2 * a), -b / (2 - 2 * a)]]
709
- };
710
- axs.utils.invert3x3Matrix = function(a) {
711
- var b = a[0][0], c = a[0][1], d = a[0][2], e = a[1][0], f = a[1][1], g = a[1][2], h = a[2][0], k = a[2][1];
712
- a = a[2][2];
713
- return axs.utils.scalarMultiplyMatrix([[f * a - g * k, d * k - c * a, c * g - d * f], [g * h - e * a, b * a - d * h, d * e - b * g], [e * k - f * h, h * c - b * k, b * f - c * e]], 1 / (b * (f * a - g * k) - c * (a * e - g * h) + d * (e * k - f * h)))
714
- };
715
- axs.utils.scalarMultiplyMatrix = function(a, b) {
716
- for(var c = [[], [], []], d = 0;3 > d;d++) {
717
- for(var e = 0;3 > e;e++) {
718
- c[d][e] = a[d][e] * b
719
- }
720
- }
721
- return c
722
- };
723
- axs.utils.kR = 0.2126;
724
- axs.utils.kB = 0.0722;
725
- axs.utils.YCC_MATRIX = axs.utils.RGBToYCCMatrix(axs.utils.kR, axs.utils.kB);
726
- axs.utils.INVERTED_YCC_MATRIX = axs.utils.invert3x3Matrix(axs.utils.YCC_MATRIX);
727
- axs.utils.convertColor = function(a, b) {
728
- var c = b[0], d = b[1], e = b[2];
729
- return[a[0][0] * c + a[0][1] * d + a[0][2] * e, a[1][0] * c + a[1][1] * d + a[1][2] * e, a[2][0] * c + a[2][1] * d + a[2][2] * e]
730
- };
731
- axs.utils.multiplyMatrices = function(a, b) {
732
- for(var c = [[], [], []], d = 0;3 > d;d++) {
733
- for(var e = 0;3 > e;e++) {
734
- c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e]
735
- }
736
- }
737
- return c
738
- };
739
- axs.utils.toYCC = function(a) {
740
603
  var b = a.red / 255, c = a.green / 255;
741
604
  a = a.blue / 255;
742
605
  b = 0.03928 >= b ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4);
743
606
  c = 0.03928 >= c ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
744
607
  a = 0.03928 >= a ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
745
- return axs.utils.convertColor(axs.utils.YCC_MATRIX, [b, c, a])
746
- };
747
- axs.utils.fromYCC = function(a) {
748
- var b = axs.utils.convertColor(axs.utils.INVERTED_YCC_MATRIX, a), c = b[0];
749
- a = b[1];
750
- b = b[2];
751
- c = 0.00303949 >= c ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055;
752
- a = 0.00303949 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - 0.055;
753
- b = 0.00303949 >= b ? 12.92 * b : 1.055 * Math.pow(b, 1 / 2.4) - 0.055;
754
- c = Math.min(Math.max(Math.round(255 * c), 0), 255);
755
- a = Math.min(Math.max(Math.round(255 * a), 0), 255);
756
- b = Math.min(Math.max(Math.round(255 * b), 0), 255);
757
- return new axs.utils.Color(c, a, b, 1)
758
- };
759
- axs.utils.scalarMultiplyMatrix = function(a, b) {
760
- for(var c = [[], [], []], d = 0;3 > d;d++) {
761
- for(var e = 0;3 > e;e++) {
762
- c[d][e] = a[d][e] * b
763
- }
764
- }
765
- return c
766
- };
767
- axs.utils.multiplyMatrices = function(a, b) {
768
- for(var c = [[], [], []], d = 0;3 > d;d++) {
769
- for(var e = 0;3 > e;e++) {
770
- c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e]
771
- }
772
- }
773
- return c
608
+ return 0.2126 * b + 0.7152 * c + 0.0722 * a
774
609
  };
775
610
  axs.utils.getContrastRatioForElement = function(a) {
776
611
  var b = window.getComputedStyle(a, null);
@@ -817,8 +652,8 @@ axs.utils.isNativeTextElement = function(a) {
817
652
  return!1
818
653
  }
819
654
  };
820
- axs.utils.isLowContrast = function(a, b, c) {
821
- return c ? 4.5 > a || !axs.utils.isLargeFont(b) && 7 > a : 3 > a || !axs.utils.isLargeFont(b) && 4.5 > a
655
+ axs.utils.isLowContrast = function(a, b) {
656
+ return 3 > a || !axs.utils.isLargeFont(b) && 4.5 > a
822
657
  };
823
658
  axs.utils.hasLabel = function(a) {
824
659
  var b = a.tagName.toLowerCase(), c = a.type ? a.type.toLowerCase() : "";
@@ -846,20 +681,12 @@ axs.utils.isElementHidden = function(a) {
846
681
  axs.utils.isElementOrAncestorHidden = function(a) {
847
682
  return axs.utils.isElementHidden(a) ? !0 : a.parentElement ? axs.utils.isElementOrAncestorHidden(a.parentElement) : !1
848
683
  };
849
- axs.utils.isInlineElement = function(a) {
850
- a = a.tagName.toUpperCase();
851
- return axs.constants.InlineElements[a]
852
- };
853
- axs.utils.getRoles = function(a) {
684
+ axs.utils.getRole = function(a) {
854
685
  if(!a.hasAttribute("role")) {
855
686
  return!1
856
687
  }
857
- a = a.getAttribute("role").split(" ");
858
- for(var b = [], c = !0, d = 0;d < a.length;d++) {
859
- var e = a[d];
860
- axs.constants.ARIA_ROLES[e] ? b.push({name:e, details:axs.constants.ARIA_ROLES[e], valid:!0}) : (b.push({name:e, valid:!1}), c = !1)
861
- }
862
- return{roles:b, valid:c}
688
+ a = a.getAttribute("role");
689
+ return axs.constants.ARIA_ROLES[a] ? {name:a, details:axs.constants.ARIA_ROLES[a], valid:!0} : {name:a, valid:!1}
863
690
  };
864
691
  axs.utils.getAriaPropertyValue = function(a, b, c) {
865
692
  var d = a.replace(/^aria-/, ""), e = axs.constants.ARIA_PROPERTIES[d], d = {name:a, rawValue:b};
@@ -1050,26 +877,6 @@ axs.AuditRule.prototype.run = function(a, b) {
1050
877
  return{result:f.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditResult.PASS, elements:f}
1051
878
  };
1052
879
  axs.AuditRule.specs = {};
1053
- axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading:"Audio elements should have controls", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
1054
- return a.querySelectorAll("audio[autoplay]")
1055
- }, test:function(a) {
1056
- return!a.querySelectorAll("[controls]").length && 3 < a.duration
1057
- }, code:"AX_AUDIO_01"};
1058
- axs.AuditRule.specs.linkWithUnclearPurpose = {name:"linkWithUnclearPurpose", heading:"The purpose of each link should be clear from the link text", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
1059
- return a.querySelectorAll("a")
1060
- }, test:function(a) {
1061
- return/^\s*click\s*here\s*[^a-z]?$/i.test(a.textContent)
1062
- }, code:"AX_TITLE_01"};
1063
- axs.AuditRule.specs.pageWithoutTitle = {name:"pageWithoutTitle", heading:"The web page should have a title that describes topic or purpose", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
1064
- return a
1065
- }, test:function(a) {
1066
- a = a.querySelector("head");
1067
- if(!a) {
1068
- return!0
1069
- }
1070
- a = a.querySelector("title");
1071
- return!a.length || !a[0].textContent
1072
- }, code:"AX_TITLE_01"};
1073
880
  axs.AuditRules = {};
1074
881
  axs.AuditRules.getRule = function(a) {
1075
882
  if(!axs.AuditRules.rules) {
@@ -1081,6 +888,126 @@ axs.AuditRules.getRule = function(a) {
1081
888
  }
1082
889
  return axs.AuditRules.rules[a]
1083
890
  };
891
+ axs.AuditResults = function() {
892
+ this.errors_ = [];
893
+ this.warnings_ = []
894
+ };
895
+ goog.exportSymbol("axs.AuditResults", axs.AuditResults);
896
+ axs.AuditResults.prototype.addError = function(a) {
897
+ "" != a && this.errors_.push(a)
898
+ };
899
+ goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.prototype.addError);
900
+ axs.AuditResults.prototype.addWarning = function(a) {
901
+ "" != a && this.warnings_.push(a)
902
+ };
903
+ goog.exportProperty(axs.AuditResults.prototype, "addWarning", axs.AuditResults.prototype.addWarning);
904
+ axs.AuditResults.prototype.numErrors = function() {
905
+ return this.errors_.length
906
+ };
907
+ goog.exportProperty(axs.AuditResults.prototype, "numErrors", axs.AuditResults.prototype.numErrors);
908
+ axs.AuditResults.prototype.numWarnings = function() {
909
+ return this.warnings_.length
910
+ };
911
+ goog.exportProperty(axs.AuditResults.prototype, "numWarnings", axs.AuditResults.prototype.numWarnings);
912
+ axs.AuditResults.prototype.getErrors = function() {
913
+ return this.errors_
914
+ };
915
+ goog.exportProperty(axs.AuditResults.prototype, "getErrors", axs.AuditResults.prototype.getErrors);
916
+ axs.AuditResults.prototype.getWarnings = function() {
917
+ return this.warnings_
918
+ };
919
+ goog.exportProperty(axs.AuditResults.prototype, "getWarnings", axs.AuditResults.prototype.getWarnings);
920
+ axs.AuditResults.prototype.toString = function() {
921
+ for(var a = "", b = 0;b < this.errors_.length;b++) {
922
+ 0 == b && (a += "\nErrors:\n");
923
+ var c = this.errors_[b], a = a + (c + "\n\n")
924
+ }
925
+ for(b = 0;b < this.warnings_.length;b++) {
926
+ 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n"
927
+ }
928
+ return a
929
+ };
930
+ goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.prototype.toString);
931
+ axs.Audit = {};
932
+ axs.AuditConfiguration = function() {
933
+ this.rules_ = {};
934
+ this.auditRulesToIgnore = this.auditRulesToRun = this.scope = null;
935
+ this.withConsoleApi = !1;
936
+ goog.exportProperty(this, "scope", this.scope);
937
+ goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun);
938
+ goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore);
939
+ goog.exportProperty(this, "withConsoleApi", this.withConsoleApi)
940
+ };
941
+ goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration);
942
+ axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) {
943
+ a in this.rules_ || (this.rules_[a] = {});
944
+ "ignore" in this.rules_[a] || (this.rules_[a].ignore = []);
945
+ Array.prototype.push.call(this.rules_[a].ignore, b)
946
+ }, getIgnoreSelectors:function(a) {
947
+ return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore : []
948
+ }};
949
+ goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.AuditConfiguration.prototype.ignoreSelectors);
950
+ goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.AuditConfiguration.prototype.getIgnoreSelectors);
951
+ axs.Audit.run = function(a) {
952
+ a = a || new axs.AuditConfiguration;
953
+ var b = a.withConsoleApi, c = [], d;
954
+ d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Object.keys(axs.AuditRule.specs);
955
+ if(a.auditRulesToIgnore) {
956
+ for(var e = 0;e < a.auditRulesToIgnore.length;e++) {
957
+ var f = a.auditRulesToIgnore[e];
958
+ 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1)
959
+ }
960
+ }
961
+ for(e = 0;e < d.length;e++) {
962
+ if((f = axs.AuditRules.getRule(d[e])) && !f.disabled && (b || !f.requiresConsoleAPI)) {
963
+ var g = [], h = a.getIgnoreSelectors(f.name);
964
+ (0 < h.length || a.scope) && g.push(h);
965
+ a.scope && g.push(a.scope);
966
+ g = f.run.apply(f, g);
967
+ g.rule = axs.utils.namedValues(f);
968
+ c.push(g)
969
+ }
970
+ }
971
+ return c
972
+ };
973
+ goog.exportSymbol("axs.Audit.run", axs.Audit.run);
974
+ axs.Audit.auditResults = function(a) {
975
+ for(var b = new axs.AuditResults, c = 0;c < a.length;c++) {
976
+ var d = a[c];
977
+ d.result == axs.constants.AuditResult.FAIL && (d.rule.severity == axs.constants.Severity.SEVERE ? b.addError(axs.Audit.accessibilityErrorMessage(d)) : b.addWarning(axs.Audit.accessibilityErrorMessage(d)))
978
+ }
979
+ return b
980
+ };
981
+ goog.exportSymbol("axs.Audit.auditResults", axs.Audit.auditResults);
982
+ axs.Audit.createReport = function(a, b) {
983
+ var c;
984
+ c = "*** Begin accessibility audit results ***\nAn accessibility audit found " + axs.Audit.auditResults(a).toString();
985
+ b && (c += "\nFor more information, please see ", c += b);
986
+ return c += "\n*** End accessibility audit results ***"
987
+ };
988
+ goog.exportSymbol("axs.Audit.createReport", axs.Audit.createReport);
989
+ axs.Audit.accessibilityErrorMessage = function(a) {
990
+ for(var b = a.rule.severity == axs.constants.Severity.SEVERE ? "Error: " : "Warning: ", b = b + (a.rule.code + " (" + a.rule.heading + ") failed on the following " + (1 == a.elements.length ? "element" : "elements")), b = 1 == a.elements.length ? b + ":" : b + (" (1 - " + Math.min(5, a.elements.length) + " of " + a.elements.length + "):"), c = Math.min(a.elements.length, 5), d = 0;d < c;d++) {
991
+ var e = a.elements[d], b = b + "\n";
992
+ try {
993
+ b += axs.utils.getQuerySelectorText(e)
994
+ }catch(f) {
995
+ b += " tagName:" + e.tagName, b += " id:" + e.id
996
+ }
997
+ }
998
+ "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information.");
999
+ return b
1000
+ };
1001
+ goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibilityErrorMessage);
1002
+ axs.browserUtils = {};
1003
+ axs.browserUtils.matchSelector = function(a, b) {
1004
+ return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSelector(b)
1005
+ };
1006
+ axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading:"Audio elements should have controls", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
1007
+ return a.querySelectorAll("audio[autoplay]")
1008
+ }, test:function(a) {
1009
+ return!a.querySelectorAll("[controls]").length && 3 < a.duration
1010
+ }, code:"AX_AUDIO_01"};
1084
1011
  axs.AuditRule.specs.badAriaAttributeValue = {name:"badAriaAttributeValue", heading:"ARIA state and property values must be valid", url:"", severity:axs.constants.Severity.SEVERE, relevantNodesSelector:function(a) {
1085
1012
  var b = "", c;
1086
1013
  for(c in axs.constants.ARIA_PROPERTIES) {
@@ -1103,7 +1030,7 @@ axs.AuditRule.specs.badAriaAttributeValue = {name:"badAriaAttributeValue", headi
1103
1030
  axs.AuditRule.specs.badAriaRole = {name:"badAriaRole", heading:"Elements with ARIA roles must use a valid, non-abstract ARIA role", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_ARIA_01:_Elements_with_ARIA_roles_must_use_a_valid,_non-abstr", severity:axs.constants.Severity.SEVERE, relevantNodesSelector:function(a) {
1104
1031
  return a.querySelectorAll("[role]")
1105
1032
  }, test:function(a) {
1106
- return!axs.utils.getRoles(a).valid
1033
+ return!axs.utils.getRole(a).valid
1107
1034
  }, code:"AX_ARIA_01"};
1108
1035
  axs.AuditRule.specs.controlsWithoutLabel = {name:"controlsWithoutLabel", heading:"Controls and media elements should have labels", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_TEXT_01:_Controls_and_media_elements_should_have_labels", severity:axs.constants.Severity.SEVERE, relevantNodesSelector:function(a) {
1109
1036
  return a.querySelectorAll('input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])')
@@ -1125,6 +1052,11 @@ axs.AuditRule.specs.imagesWithoutAltText = {name:"imagesWithoutAltText", heading
1125
1052
  }, test:function(a) {
1126
1053
  return!a.hasAttribute("alt") && "presentation" != a.getAttribute("role")
1127
1054
  }, code:"AX_TEXT_02"};
1055
+ axs.AuditRule.specs.linkWithUnclearPurpose = {name:"linkWithUnclearPurpose", heading:"The purpose of each link should be clear from the link text", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
1056
+ return a.querySelectorAll("a")
1057
+ }, test:function(a) {
1058
+ return/^\s*click\s*here\s*[^a-z]?$/i.test(a.textContent)
1059
+ }, code:"AX_TITLE_01"};
1128
1060
  axs.AuditRule.specs.lowContrastElements = {name:"lowContrastElements", heading:"Text elements should have a reasonable contrast ratio", url:"https://code.google.com/p/accessibility-developer-tools/wiki/AuditRules#AX_COLOR_01:_Text_elements_should_have_a_reasonable_contrast_rat", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
1129
1061
  return document.evaluate('/html/body//text()[normalize-space(.)!=""]/parent::*[name()!="script"]', a, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
1130
1062
  }, test:function(a) {
@@ -1162,19 +1094,31 @@ axs.AuditRule.specs.nonExistentAriaLabelledbyElement = {name:"nonExistentAriaLab
1162
1094
  }
1163
1095
  return!1
1164
1096
  }, code:"AX_ARIA_02"};
1097
+ axs.AuditRule.specs.pageWithoutTitle = {name:"pageWithoutTitle", heading:"The web page should have a title that describes topic or purpose", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
1098
+ return a
1099
+ }, test:function(a) {
1100
+ a = a.querySelector("head");
1101
+ if(!a) {
1102
+ return!0
1103
+ }
1104
+ a = a.querySelector("title");
1105
+ return!a.length || !a[0].textContent
1106
+ }, code:"AX_TITLE_01"};
1165
1107
  axs.AuditRule.specs.requiredAriaAttributeMissing = {name:"requiredAriaAttributeMissing", heading:"Elements with ARIA roles must have all required attributes for that role", url:"", severity:axs.constants.Severity.SEVERE, relevantNodesSelector:function(a) {
1166
1108
  return a.querySelectorAll("[role]")
1167
1109
  }, test:function(a) {
1168
- var b = axs.utils.getRoles(a);
1110
+ var b = axs.utils.getRole(a);
1169
1111
  if(!b.valid) {
1170
1112
  return!1
1171
1113
  }
1172
- for(var c = 0;c < b.roles.length;c++) {
1173
- var d = b.roles[c].details.requiredPropertiesSet, e;
1174
- for(e in d) {
1175
- if(d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PROPERTIES[d] || a.hasAttribute(e))) {
1176
- return!0
1177
- }
1114
+ var b = b.details.requiredPropertiesSet, c;
1115
+ for(c in b) {
1116
+ b = c.replace(/^aria-/, "");
1117
+ if("defaultValue" in axs.constants.ARIA_PROPERTIES[b]) {
1118
+ return!1
1119
+ }
1120
+ if(!a.hasAttribute(c)) {
1121
+ return!0
1178
1122
  }
1179
1123
  }
1180
1124
  }, code:"AX_ARIA_03"};
@@ -1193,354 +1137,4 @@ axs.AuditRule.specs.videoWithoutCaptions = {name:"videoWithoutCaptions", heading
1193
1137
  }, test:function(a) {
1194
1138
  return!a.querySelectorAll("track[kind=captions]").length
1195
1139
  }, code:"AX_VIDEO_01"};
1196
- axs.Audit = {};
1197
- axs.AuditConfiguration = function() {
1198
- this.rules_ = {};
1199
- this.auditRulesToIgnore = this.auditRulesToRun = this.scope = null;
1200
- this.withConsoleApi = !1;
1201
- goog.exportProperty(this, "scope", this.scope);
1202
- goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun);
1203
- goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore);
1204
- goog.exportProperty(this, "withConsoleApi", this.withConsoleApi)
1205
- };
1206
- goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration);
1207
- axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) {
1208
- a in this.rules_ || (this.rules_[a] = {});
1209
- "ignore" in this.rules_[a] || (this.rules_[a].ignore = []);
1210
- Array.prototype.push.call(this.rules_[a].ignore, b)
1211
- }, getIgnoreSelectors:function(a) {
1212
- return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore : []
1213
- }};
1214
- goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.AuditConfiguration.prototype.ignoreSelectors);
1215
- goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.AuditConfiguration.prototype.getIgnoreSelectors);
1216
- axs.Audit.run = function(a) {
1217
- a = a || new axs.AuditConfiguration;
1218
- var b = a.withConsoleApi, c = [], d;
1219
- d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Object.keys(axs.AuditRule.specs);
1220
- if(a.auditRulesToIgnore) {
1221
- for(var e = 0;e < a.auditRulesToIgnore.length;e++) {
1222
- var f = a.auditRulesToIgnore[e];
1223
- 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1)
1224
- }
1225
- }
1226
- for(e = 0;e < d.length;e++) {
1227
- if((f = axs.AuditRules.getRule(d[e])) && !f.disabled && (b || !f.requiresConsoleAPI)) {
1228
- var g = [], h = a.getIgnoreSelectors(f.name);
1229
- (0 < h.length || a.scope) && g.push(h);
1230
- a.scope && g.push(a.scope);
1231
- g = f.run.apply(f, g);
1232
- g.rule = axs.utils.namedValues(f);
1233
- c.push(g)
1234
- }
1235
- }
1236
- return c
1237
- };
1238
- goog.exportSymbol("axs.Audit.run", axs.Audit.run);
1239
- axs.Audit.auditResults = function(a) {
1240
- for(var b = new axs.AuditResults, c = 0;c < a.length;c++) {
1241
- var d = a[c];
1242
- d.result == axs.constants.AuditResult.FAIL && (d.rule.severity == axs.constants.Severity.SEVERE ? b.addError(axs.Audit.accessibilityErrorMessage(d)) : b.addWarning(axs.Audit.accessibilityErrorMessage(d)))
1243
- }
1244
- return b
1245
- };
1246
- goog.exportSymbol("axs.Audit.auditResults", axs.Audit.auditResults);
1247
- axs.Audit.createReport = function(a, b) {
1248
- var c;
1249
- c = "*** Begin accessibility audit results ***\nAn accessibility audit found " + axs.Audit.auditResults(a).toString();
1250
- b && (c += "\nFor more information, please see ", c += b);
1251
- return c += "\n*** End accessibility audit results ***"
1252
- };
1253
- goog.exportSymbol("axs.Audit.createReport", axs.Audit.createReport);
1254
- axs.Audit.accessibilityErrorMessage = function(a) {
1255
- for(var b = a.rule.severity == axs.constants.Severity.SEVERE ? "Error: " : "Warning: ", b = b + (a.rule.code + " (" + a.rule.heading + ") failed on the following " + (1 == a.elements.length ? "element" : "elements")), b = 1 == a.elements.length ? b + ":" : b + (" (1 - " + Math.min(5, a.elements.length) + " of " + a.elements.length + "):"), c = Math.min(a.elements.length, 5), d = 0;d < c;d++) {
1256
- var e = a.elements[d], b = b + "\n";
1257
- try {
1258
- b += axs.utils.getQuerySelectorText(e)
1259
- }catch(f) {
1260
- b += " tagName:" + e.tagName, b += " id:" + e.id
1261
- }
1262
- }
1263
- "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information.");
1264
- return b
1265
- };
1266
- goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibilityErrorMessage);
1267
- axs.content = {};
1268
- axs.content.auditResultNodes || (axs.content.auditResultNodes = {});
1269
- axs.content.lastNodeId || (axs.content.lastNodeId = 0);
1270
- axs.content.convertNodeToResult = function(a) {
1271
- var b = "" + axs.content.lastNodeId++;
1272
- axs.content.auditResultNodes[b] = a;
1273
- return b
1274
- };
1275
- axs.content.getResultNode = function(a) {
1276
- var b = axs.content.auditResultNodes[a];
1277
- delete axs.content.auditResultNodes[a];
1278
- return b
1279
- };
1280
- axs.properties = {};
1281
- axs.properties.TEXT_CONTENT_XPATH = 'text()[normalize-space(.)!=""]/parent::*[name()!="script"]';
1282
- axs.properties.getFocusProperties = function(a) {
1283
- a = a.getAttribute("tabindex");
1284
- return void 0 != a ? {tabindex:{value:a, valid:!0}} : null
1285
- };
1286
- axs.properties.getColorProperties = function(a) {
1287
- var b = {};
1288
- b.contrastRatio = axs.properties.getContrastRatioProperties(a);
1289
- return b.contrastRatio ? b : null
1290
- };
1291
- axs.properties.getContrastRatioProperties = function(a) {
1292
- var b = document.evaluate(axs.properties.TEXT_CONTENT_XPATH, a, null, XPathResult.ANY_TYPE, null).iterateNext();
1293
- if(!b || b != a) {
1294
- return null
1295
- }
1296
- var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c, a);
1297
- if(!d) {
1298
- return null
1299
- }
1300
- b.backgroundColor = axs.utils.colorToString(d);
1301
- var e = axs.utils.getFgColor(c, d);
1302
- b.foregroundColor = axs.utils.colorToString(e);
1303
- a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a);
1304
- if(!a) {
1305
- return null
1306
- }
1307
- b.value = a.toFixed(2);
1308
- axs.utils.isLowContrast(a, c) && (b.alert = !0);
1309
- (a = axs.utils.suggestColors(d, e, a, c)) && Object.keys(a).length && (b.suggestedColors = a);
1310
- return b
1311
- };
1312
- axs.properties.findTextAlternatives = function(a, b, c) {
1313
- var d = c || !1;
1314
- c = axs.utils.asElement(a);
1315
- if(!c || !d && axs.utils.isElementOrAncestorHidden(c)) {
1316
- return null
1317
- }
1318
- if(a.nodeType == Node.TEXT_NODE) {
1319
- return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.properties.getLastWord(c.text), b.content = c, a.textContent
1320
- }
1321
- a = null;
1322
- d || (a = axs.properties.getTextFromAriaLabelledby(c, b));
1323
- if(c.hasAttribute("aria-label")) {
1324
- var e = {type:"text"};
1325
- e.text = c.getAttribute("aria-label");
1326
- e.lastWord = axs.properties.getLastWord(e.text);
1327
- a ? e.unused = !0 : d && axs.utils.elementIsHtmlControl(c) || (a = e.text);
1328
- b.ariaLabel = e
1329
- }
1330
- c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs.properties.getTextFromHostLangaugeAttributes(c, b, a));
1331
- if(d && axs.utils.elementIsHtmlControl(c)) {
1332
- e = c.ownerDocument.defaultView;
1333
- if(c instanceof e.HTMLInputElement) {
1334
- var f = c;
1335
- "text" == f.type && f.value && 0 < f.value.length && (b.controlValue = {text:f.value});
1336
- "range" == f.type && (b.controlValue = {text:f.value})
1337
- }
1338
- c instanceof e.HTMLSelectElement && (b.controlValue = {text:f.value});
1339
- b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text)
1340
- }
1341
- if(d && axs.utils.elementIsAriaWidget(c)) {
1342
- d = c.getAttribute("role");
1343
- "textbox" == d && c.textContent && 0 < c.textContent.length && (b.controlValue = {text:c.textContent});
1344
- if("slider" == d || "spinbutton" == d) {
1345
- c.hasAttribute("aria-valuetext") ? b.controlValue = {text:c.getAttribute("aria-valuetext")} : c.hasAttribute("aria-valuenow") && (b.controlValue = {value:c.getAttribute("aria-valuenow"), text:"" + c.getAttribute("aria-valuenow")})
1346
- }
1347
- if("menu" == d) {
1348
- for(var g = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemradio]"), f = [], e = 0;e < g.length;e++) {
1349
- "true" == g[e].getAttribute("aria-checked") && f.push(g[e])
1350
- }
1351
- if(0 < f.length) {
1352
- g = "";
1353
- for(e = 0;e < f.length;e++) {
1354
- g += axs.properties.findTextAlternatives(f[e], {}, !0), e < f.length - 1 && (g += ", ")
1355
- }
1356
- b.controlValue = {text:g}
1357
- }
1358
- }
1359
- if("combobox" == d || "select" == d) {
1360
- b.controlValue = {text:"TODO"}
1361
- }
1362
- b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text)
1363
- }
1364
- if(d = axs.properties.getTextFromDescendantContent(c)) {
1365
- f = {type:"text"}, f.text = d, f.lastWord = axs.properties.getLastWord(f.text), a ? f.unused = !0 : a = d, b.content = f
1366
- }
1367
- c.hasAttribute("title") && (d = {type:"string", valid:!0}, d.text = c.getAttribute("title"), d.lastWord = axs.properties.getLastWord(d.lastWord), a ? d.unused = !0 : a = d.text, b.title = d);
1368
- return 0 == Object.keys(b).length && null == a ? null : a
1369
- };
1370
- axs.properties.getTextFromDescendantContent = function(a) {
1371
- if(a.hasAttribute("role")) {
1372
- var b = a.getAttribute("role");
1373
- if((b = axs.constants.ARIA_ROLES[b]) && (!b.namefrom || 0 > b.namefrom.indexOf("contents"))) {
1374
- return null
1375
- }
1376
- }
1377
- a = a.childNodes;
1378
- for(var b = [], c = 0;c < a.length;c++) {
1379
- var d = axs.properties.findTextAlternatives(a[c], {}, !0);
1380
- d && 0 < d.trim().length && b.push(d.trim())
1381
- }
1382
- return b.length ? b.join(" ") : null
1383
- };
1384
- axs.properties.getTextFromAriaLabelledby = function(a, b) {
1385
- var c = null;
1386
- if(!a.hasAttribute("aria-labelledby")) {
1387
- return c
1388
- }
1389
- for(var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f = [], g = [], h = 0;h < d.length;h++) {
1390
- var k = {type:"element"}, m = d[h];
1391
- k.value = m;
1392
- var l = document.getElementById(m);
1393
- l ? (k.valid = !0, k.text = axs.properties.findTextAlternatives(l, {}, !0), k.lastWord = axs.properties.getLastWord(k.text), f.push(l.textContent.trim()), k.element = l) : (k.valid = !1, e.valid = !1, k.errorMessage = {messageKey:"noElementWithId", args:[m]});
1394
- g.push(k)
1395
- }
1396
- 0 < g.length && (g[g.length - 1].last = !0, e.values = g, e.text = f.join(" "), e.lastWord = axs.properties.getLastWord(e.text), c = e.text, b.ariaLabelledby = e);
1397
- return c
1398
- };
1399
- axs.properties.getTextFromHostLangaugeAttributes = function(a, b, c) {
1400
- if(axs.browserUtils.matchSelector(a, "img")) {
1401
- if(a.hasAttribute("alt")) {
1402
- var d = {type:"string", valid:!0};
1403
- d.text = a.getAttribute("alt");
1404
- c ? d.unused = !0 : c = d.text;
1405
- b.alt = d
1406
- }else {
1407
- d = {valid:!1, errorMessage:"No alt value provided"}, b.alt = d, d = a.src, "string" == typeof d && (c = d.split("/").pop(), b.filename = {text:c})
1408
- }
1409
- }
1410
- if(axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])')) {
1411
- if(a.hasAttribute("id")) {
1412
- for(var d = document.querySelectorAll("label[for=" + a.id + "]"), e = {}, f = [], g = [], h = 0;h < d.length;h++) {
1413
- var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternatives(m, {}, !0);
1414
- l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim()));
1415
- k.element = m;
1416
- f.push(k)
1417
- }
1418
- 0 < f.length && (f[f.length - 1].last = !0, e.values = f, e.text = g.join(" "), e.lastWord = axs.properties.getLastWord(e.text), c ? e.unused = !0 : c = e.text, b.labelFor = e)
1419
- }
1420
- d = a.parentElement;
1421
- for(e = {};d;) {
1422
- if("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) {
1423
- e.type = "element";
1424
- e.text = axs.properties.findTextAlternatives(f, {}, !0);
1425
- e.lastWord = axs.properties.getLastWord(e.text);
1426
- e.element = f;
1427
- break
1428
- }
1429
- d = d.parentElement
1430
- }
1431
- e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e);
1432
- Object.keys(b).length || (b.noLabel = !0)
1433
- }
1434
- return c
1435
- };
1436
- axs.properties.getLastWord = function(a) {
1437
- if(!a) {
1438
- return null
1439
- }
1440
- var b = a.lastIndexOf(" ") + 1, c = a.length - 10;
1441
- return a.substring(b > c ? b : c)
1442
- };
1443
- axs.properties.getTextProperties = function(a) {
1444
- var b = {};
1445
- a = axs.properties.findTextAlternatives(a, b);
1446
- if(0 == Object.keys(b).length) {
1447
- if(!a) {
1448
- return null
1449
- }
1450
- b.hasProperties = !1
1451
- }else {
1452
- b.hasProperties = !0
1453
- }
1454
- b.computedText = a;
1455
- b.lastWord = axs.properties.getLastWord(a);
1456
- return b
1457
- };
1458
- axs.properties.getAriaProperties = function(a) {
1459
- console.log("getAriaProperties", a);
1460
- var b = {}, c = axs.properties.getGlobalAriaProperties(a), d;
1461
- for(d in axs.constants.ARIA_PROPERTIES) {
1462
- var e = "aria-" + d;
1463
- if(a.hasAttribute(e)) {
1464
- var f = a.getAttribute(e);
1465
- c[e] = axs.utils.getAriaPropertyValue(e, f, a)
1466
- }
1467
- }
1468
- console.log("statesAndProperties", c);
1469
- 0 < Object.keys(c).length && (b.properties = axs.utils.values(c));
1470
- f = axs.utils.getRoles(a);
1471
- if(!f) {
1472
- return Object.keys(b).length ? b : null
1473
- }
1474
- b.roles = f;
1475
- if(!f.valid || !f.roles) {
1476
- return b
1477
- }
1478
- for(var e = f.roles, g = 0;g < e.length;g++) {
1479
- var h = e[g];
1480
- if(h.details && h.details.propertiesSet) {
1481
- for(d in h.details.propertiesSet) {
1482
- d in c || (a.hasAttribute(d) ? (f = a.getAttribute(d), c[d] = axs.utils.getAriaPropertyValue(d, f, a), "values" in c[d] && (f = c[d].values, f[f.length - 1].isLast = !0)) : h.details.requiredPropertiesSet[d] && (c[d] = {name:d, valid:!1, reason:"Required property not set"}))
1483
- }
1484
- }
1485
- }
1486
- 0 < Object.keys(c).length && (b.properties = axs.utils.values(c));
1487
- return 0 < Object.keys(b).length ? b : null
1488
- };
1489
- axs.properties.getGlobalAriaProperties = function(a) {
1490
- for(var b = {}, c = 0;c < axs.constants.GLOBAL_PROPERTIES.length;c++) {
1491
- var d = axs.constants.GLOBAL_PROPERTIES[c];
1492
- if(a.hasAttribute(d)) {
1493
- var e = a.getAttribute(d);
1494
- b[d] = axs.utils.getAriaPropertyValue(d, e, a)
1495
- }
1496
- }
1497
- return b
1498
- };
1499
- axs.properties.getVideoProperties = function(a) {
1500
- if(!axs.browserUtils.matchSelector(a, "video")) {
1501
- return null
1502
- }
1503
- var b = {};
1504
- b.captionTracks = axs.properties.getTrackElements(a, "captions");
1505
- b.descriptionTracks = axs.properties.getTrackElements(a, "descriptions");
1506
- b.chapterTracks = axs.properties.getTrackElements(a, "chapters");
1507
- return b
1508
- };
1509
- axs.properties.getTrackElements = function(a, b) {
1510
- var c = a.querySelectorAll("track[kind=" + b + "]"), d = {};
1511
- if(!c.length) {
1512
- return d.valid = !1, d.reason = {messageKey:"noTracksProvided", args:[[b]]}, d
1513
- }
1514
- d.valid = !0;
1515
- for(var e = [], f = 0;f < c.length;f++) {
1516
- var g = {}, h = c[f].getAttribute("src"), k = c[f].getAttribute("srcLang"), m = c[f].getAttribute("label");
1517
- h ? (g.valid = !0, g.src = h) : (g.valid = !1, g.reason = {messageKey:"noSrcProvided"});
1518
- h = "";
1519
- m && (h += m, k && (h += " "));
1520
- k && (h += "(" + k + ")");
1521
- "" == h && (h = "[[object Object]]");
1522
- g.name = h;
1523
- e.push(g)
1524
- }
1525
- d.values = e;
1526
- return d
1527
- };
1528
- axs.properties.getAllProperties = function(a) {
1529
- var b = axs.utils.asElement(a);
1530
- if(!b) {
1531
- return{}
1532
- }
1533
- var c = {};
1534
- c.ariaProperties = axs.properties.getAriaProperties(b);
1535
- c.colorProperties = axs.properties.getColorProperties(b);
1536
- c.focusProperties = axs.properties.getFocusProperties(b);
1537
- c.textProperties = axs.properties.getTextProperties(a);
1538
- c.videoProperties = axs.properties.getVideoProperties(b);
1539
- return c
1540
- };
1541
- axs.AuditRule.specs.mainRoleOnInappropriateElement = {name:"mainRoleOnInappropriateElement", heading:"role=main should only appear on significant elements", url:"", severity:axs.constants.Severity.WARNING, relevantNodesSelector:function(a) {
1542
- return a.querySelectorAll("[role~=main]")
1543
- }, test:function(a) {
1544
- return axs.utils.isInlineElement(a) || 50 > axs.properties.findTextAlternatives(a, {}).length ? !0 : !1
1545
- }, code:"AX_ARIA_04"};
1546
1140
 
metadata CHANGED
@@ -1,46 +1,52 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-accessible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Case Commons
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-07-19 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: capybara
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: selenium-webdriver
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: bundler
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -55,57 +62,65 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rspec
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: pry
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: tddium
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: sinatra
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - '>='
115
+ - - ! '>='
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - '>='
123
+ - - ! '>='
109
124
  - !ruby/object:Gem::Version
110
125
  version: '0'
111
126
  description: Capybara extension and webdriver for automated accessibility testing
@@ -136,26 +151,27 @@ files:
136
151
  homepage: https://github.com/Casecommons/capybara-accessible
137
152
  licenses:
138
153
  - MIT
139
- metadata: {}
140
154
  post_install_message:
141
155
  rdoc_options: []
142
156
  require_paths:
143
157
  - lib
144
158
  required_ruby_version: !ruby/object:Gem::Requirement
159
+ none: false
145
160
  requirements:
146
- - - '>='
161
+ - - ! '>='
147
162
  - !ruby/object:Gem::Version
148
163
  version: '0'
149
164
  required_rubygems_version: !ruby/object:Gem::Requirement
165
+ none: false
150
166
  requirements:
151
- - - '>='
167
+ - - ! '>='
152
168
  - !ruby/object:Gem::Version
153
169
  version: '0'
154
170
  requirements: []
155
171
  rubyforge_project:
156
- rubygems_version: 2.0.3
172
+ rubygems_version: 1.8.19
157
173
  signing_key:
158
- specification_version: 4
174
+ specification_version: 3
159
175
  summary: A Selenium based webdriver and Capybara extension that runs Google Accessibility
160
176
  Developer Tools auditing assertions on page visits.
161
177
  test_files:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 90f158b13863e2595b10ae6e9befac3966dab300
4
- data.tar.gz: 8fe78756a802e34b9857d47470f0bf07a7e5113c
5
- SHA512:
6
- metadata.gz: 4b2b0e0dcd7f04e4b874b06b9b813cd921c1d5f18cc06490dbcff88be2224876e7f7b1e726c1300376acb9dbbf5112803e31a70b47c6df6a307b5ec7ec3ac1ac
7
- data.tar.gz: 75356e132cb5abf0e91fe2ece6f37080d05cbda94b170f70cf6ef2adda670cbb155f0af57d5d132f9c9952d4423c058b74b0ee9c1bf4c1ad2ed37c11b5bff14c