diff --git a/Changelog.md b/Changelog.md index e1290cb4..d6af9944 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,16 @@ +## 2.7.1-rc.1 - 2015-06-23 + +### Bug fixes: + +* Check for null `textAlternatives` in `FocusableElementNotVisibleAndNotAriaHidden`'s `relevantElementMatcher` method. + +## 2.7.1-rc.0 - 2015-06-15 + ### Enhancements: * Rework findTextAlternatives not to return non-exposed text alternatives. * Add Bower config (#157) +* Pull color code into separate file. +* Improve color suggestion algorithm. ### Bug fixes: * Check for any text alternatives when assessing unlabeled images (#154). diff --git a/Gruntfile.js b/Gruntfile.js index e13ff852..c64db54a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -18,6 +18,7 @@ module.exports = function(grunt) { './src/js/axs.js', './src/js/BrowserUtils.js', './src/js/Constants.js', + './src/js/Color.js', './src/js/AccessibilityUtils.js', './src/js/Properties.js', './src/js/AuditRule.js', @@ -53,7 +54,8 @@ module.exports = function(grunt) { }, clean: { - all: ['.tmp', 'dist'] + local: ['.tmp'], + dist: ['dist'] }, bump: { @@ -69,7 +71,7 @@ module.exports = function(grunt) { coffee: { compile: { files: { - '.tmp/util/gh_repo.js': 'src/util/gh_repo.coffee' + '.tmp/util/gh_repo.js': 'scripts/gh_repo.coffee' } } }, @@ -220,6 +222,7 @@ module.exports = function(grunt) { 'prompt:gh-release', 'build', 'test:unit', + 'clean:dist', 'copy:dist', 'bump-only:' + releaseType, 'changelog:' + releaseType, @@ -237,9 +240,9 @@ module.exports = function(grunt) { grunt.task.run('git-describe'); }); - grunt.registerTask('build', ['clean:all', 'save-revision', 'closurecompiler:minify']); + grunt.registerTask('build', ['clean:local', 'save-revision', 'closurecompiler:minify']); grunt.registerTask('test:unit', ['qunit']); - grunt.registerTask('dist', ['build', 'copy:dist']); + grunt.registerTask('dist', ['clean:dist', 'build', 'copy:dist']); grunt.registerTask('travis', ['closurecompiler:minify', 'test:unit']); grunt.registerTask('default', ['build', 'test:unit']); }; diff --git a/bower.json b/bower.json index 2611fe5a..7dfacb9e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "accessibility-developer-tools", - "version": "2.7.0", + "version": "2.7.1-rc.1", "homepage": "https://github.com/GoogleChrome/accessibility-developer-tools", "authors": [ "Google" diff --git a/dist/js/axs_testing.js b/dist/js/axs_testing.js index d8fbf82b..efaa5287 100644 --- a/dist/js/axs_testing.js +++ b/dist/js/axs_testing.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Generated from http://github.com/GoogleChrome/accessibility-developer-tools/tree/a33b34feb4bf5c6990c9d88f98c3c8e3115168ab + * Generated from http://github.com/GoogleChrome/accessibility-developer-tools/tree/91ec7093ac31a45c6b3611e65e08ef82ecdc11d1 * * See project README for build steps. */ @@ -62,7 +62,7 @@ goog.setTestOnly = function(a) { goog.forwardDeclare = function(a) { }; COMPILED || (goog.isProvided_ = function(a) { - return !goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByName(a)); + return!goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByName(a)); }, goog.implicitNamespaces_ = {}); goog.getObjectByName = function(a, b) { for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) { @@ -153,14 +153,14 @@ goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathToN var b = goog.global.document; if ("complete" == b.readyState) { if (/\bdeps.js$/.test(a)) { - return !1; + return!1; } throw Error('Cannot write "' + a + '" after document load'); } b.write(' - +
diff --git a/test/index.html b/test/index.html index d142dc11..b16fc580 100644 --- a/test/index.html +++ b/test/index.html @@ -9,6 +9,7 @@ + @@ -25,6 +26,7 @@ + @@ -45,6 +47,7 @@ + @@ -57,6 +60,7 @@ + diff --git a/test/js/color-test.js b/test/js/color-test.js new file mode 100644 index 00000000..72f897df --- /dev/null +++ b/test/js/color-test.js @@ -0,0 +1,53 @@ +// Copyright 2012 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +module("Contrast Ratio", { + setup: function () { + var fixture = document.createElement('div'); + document.getElementById('qunit-fixture').appendChild(fixture); + this.fixture_ = fixture; + this.black_ = {"red": 0, "green": 0, "blue": 0, "alpha": 1}; + this.white_ = {"red": 255, "green": 255, "blue": 255, "alpha": 1}; + } +}); +test("Black and white.", function () { + equal(axs.color.calculateContrastRatio(this.white_, this.black_), 21); + equal(axs.color.calculateContrastRatio(this.black_, this.white_), 21); +}); +test("Same color === no contrast.", function () { + equal(axs.color.calculateContrastRatio(this.white_, this.white_), 1); + equal(axs.color.calculateContrastRatio(this.black_, this.black_), 1); +}); +test("Transparent foreground === no contrast.", function () { + equal(axs.color.calculateContrastRatio({"red": 0, "green": 0, "blue": 0, "alpha": 0}, this.white_), 1); +}); + +module("parseColor"); +test("parses alpha values correctly", function() { + var colorString = 'rgba(255, 255, 255, .47)'; + var color = axs.color.parseColor(colorString); + equal(color.red, 255); + equal(color.blue, 255); + equal(color.green, 255); + equal(color.alpha, .47); +}); + +module("suggestColors"); +test("suggests correct grey values", function() { + var white = new axs.color.Color(255, 255, 255, 1) + var desiredContrastRatios = { AA: 4.5, AAA: 7.0 }; + var suggestions = axs.color.suggestColors(white, white, desiredContrastRatios); + deepEqual(suggestions, { AA: { bg: "#ffffff", contrast: "4.54", fg: "#767676" }, + AAA: { bg: "#ffffff", contrast: "7.00", fg: "#595959" } }); +}); diff --git a/test/js/utils-test.js b/test/js/utils-test.js index 93c0a185..574dbff8 100644 --- a/test/js/utils-test.js +++ b/test/js/utils-test.js @@ -12,27 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -module("Contrast Ratio", { - setup: function () { - var fixture = document.createElement('div'); - document.getElementById('qunit-fixture').appendChild(fixture); - this.fixture_ = fixture; - this.black_ = {"red": 0, "green": 0, "blue": 0, "alpha": 1}; - this.white_ = {"red": 255, "green": 255, "blue": 255, "alpha": 1}; - } -}); -test("Black and white.", function () { - equal(axs.utils.calculateContrastRatio(this.white_, this.black_), 21); - equal(axs.utils.calculateContrastRatio(this.black_, this.white_), 21); -}); -test("Same color === no contrast.", function () { - equal(axs.utils.calculateContrastRatio(this.white_, this.white_), 1); - equal(axs.utils.calculateContrastRatio(this.black_, this.black_), 1); -}); -test("Transparent foreground === no contrast.", function () { - equal(axs.utils.calculateContrastRatio({"red": 0, "green": 0, "blue": 0, "alpha": 0}, this.white_), 1); -}); - module("Zero Area", { setup: function () { var fixture = document.createElement('div'); @@ -143,16 +122,6 @@ test("nth-of-type does not refer to a selector but a tagName", function() { 'selector "' + selector + '" does not match element'); }); -module("parseColor"); -test("parses alpha values correctly", function() { - var colorString = 'rgba(255, 255, 255, .47)'; - var color = axs.utils.parseColor(colorString); - equal(color.red, 255); - equal(color.blue, 255); - equal(color.green, 255); - equal(color.alpha, .47); -}); - module("getIdReferrers", { setup: function () { this.fixture_ = document.getElementById('qunit-fixture');