diff --git a/lib/checks/mobile/css-orientation-lock.json b/lib/checks/mobile/css-orientation-lock.json index 5bb9dacb91..8bdadb0a15 100644 --- a/lib/checks/mobile/css-orientation-lock.json +++ b/lib/checks/mobile/css-orientation-lock.json @@ -5,7 +5,8 @@ "impact": "serious", "messages": { "pass": "Display is operable, and orientation lock does not exist", - "fail": "CSS Orientation lock is applied, and makes display inoperable" + "fail": "CSS Orientation lock is applied, and makes display inoperable", + "incomplete": "CSS Orientation lock cannot be determined" } } } diff --git a/lib/core/utils/preload.js b/lib/core/utils/preload.js index 312d8b7349..38cee08077 100644 --- a/lib/core/utils/preload.js +++ b/lib/core/utils/preload.js @@ -14,7 +14,7 @@ function isValidPreloadObject(preload) { * @return {boolean} defaults to true */ axe.utils.shouldPreload = function shouldPreload(options) { - if (!options || !options.preload) { + if (!options || options.preload === undefined || options.preload === null) { return true; // by default `preload` requested assets eg: ['cssom'] } if (typeof options.preload === 'boolean') { diff --git a/test/core/utils/preload.js b/test/core/utils/preload.js index c2717f5cf9..2a26e8a7b2 100644 --- a/test/core/utils/preload.js +++ b/test/core/utils/preload.js @@ -38,6 +38,23 @@ describe('axe.utils.preload', function() { }); }); + it('should return empty array as result', function(done) { + var options = { + preload: false + }; + var actual = axe.utils.preload(options); + actual + .then(function(results) { + assert.isDefined(results); + assert.isArray(results); + assert.lengthOf(results, 0); + done(); + }) + .catch(function(error) { + done(error); + }); + }); + it('should return an object with property cssom and verify result is same output from preloadCssom', function(done) { var options = { preload: { @@ -63,6 +80,29 @@ describe('axe.utils.preload', function() { describe('axe.utils.shouldPreload', function() { it('should return true if preload configuration is valid', function() { + var actual = axe.utils.shouldPreload({ + preload: { + assets: ['cssom'] + } + }); + assert.isTrue(actual); + }); + + it('should return true if preload is undefined', function() { + var actual = axe.utils.shouldPreload({ + preload: undefined + }); + assert.isTrue(actual); + }); + + it('should return true if preload is null', function() { + var actual = axe.utils.shouldPreload({ + preload: null + }); + assert.isTrue(actual); + }); + + it('should return true if preload is not set', function() { var actual = axe.utils.shouldPreload({}); assert.isTrue(actual); });