-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add environment details to results (#1353)
* feat: add version information to results * feat: add version information to results * use tabs instead of spaces * add definitions to typescript * create helper function for environment data * add done to tests
- Loading branch information
1 parent
4b50f7d
commit e795f7d
Showing
13 changed files
with
136 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*global helpers */ | ||
|
||
/** | ||
* Add information about the environment axe was run in. | ||
* @return {Object} | ||
*/ | ||
helpers.getEnvironmentData = function getEnvironmentData() { | ||
'use strict'; | ||
var orientation = window.screen | ||
? screen.msOrientation || | ||
(screen.orientation || screen.mozOrientation || {}) | ||
: {}; | ||
|
||
return { | ||
testEngine: { | ||
name: 'axe-core', | ||
version: axe.version | ||
}, | ||
testRunner: { | ||
name: axe._audit.brand | ||
}, | ||
testEnvironment: { | ||
userAgent: navigator.userAgent, | ||
windowWidth: window.innerWidth, | ||
windowHeight: window.innerHeight, | ||
orientationAngle: orientation.angle, | ||
orientationType: orientation.type | ||
}, | ||
timestamp: new Date().toISOString(), | ||
url: window.location.href | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
describe('helpers.getEnvironmentData', function() { | ||
'use strict'; | ||
|
||
it('should return a `testEngine` property', function() { | ||
var data = helpers.getEnvironmentData(); | ||
assert.isObject(data.testEngine); | ||
assert.equal(data.testEngine.name, 'axe-core'); | ||
assert.equal(data.testEngine.version, axe.version); | ||
}); | ||
|
||
it('should return a `testRunner` property', function() { | ||
var data = helpers.getEnvironmentData(); | ||
assert.isObject(data.testRunner); | ||
assert.equal(data.testRunner.name, axe._audit.brand); | ||
}); | ||
|
||
it('should return a `testEnvironment` property', function() { | ||
var data = helpers.getEnvironmentData(); | ||
assert.isObject(data.testEnvironment); | ||
assert.ok(data.testEnvironment.userAgent); | ||
assert.ok(data.testEnvironment.windowWidth); | ||
assert.ok(data.testEnvironment.windowHeight); | ||
assert.isNotNull(data.testEnvironment.orientationAngle); | ||
assert.isNotNull(data.testEnvironment.orientationType); | ||
}); | ||
|
||
it('should return a `timestamp` property`', function() { | ||
var data = helpers.getEnvironmentData(); | ||
assert.isDefined(data.timestamp); | ||
}); | ||
|
||
it('should return a `url` property', function() { | ||
var data = helpers.getEnvironmentData(); | ||
assert.isDefined(data.url); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters