Skip to content

Commit

Permalink
fix(IE): Skip non-empty-if-present test
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Oct 20, 2017
1 parent 5bd8488 commit 9c81f8d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
7 changes: 0 additions & 7 deletions lib/checks/shared/non-empty-if-present.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ let nodeName = node.nodeName.toUpperCase();
let type = (node.getAttribute('type') || '').toLowerCase();
let label = node.getAttribute('value');

// Edge / IE set a default value, we want to filter those out.
const { submitDefault, resetDefault } = axe.commons.text.EdgeFormDefaults;
if ((type === 'submit' && label === submitDefault) ||
(type === 'reset' && label === resetDefault)) {
label = null;
}

this.data(label);

if (nodeName === 'INPUT' && ['submit', 'reset'].includes(type)) {
Expand Down
7 changes: 0 additions & 7 deletions lib/commons/text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,3 @@
* @memberof axe.commons
*/
var text = commons.text = { EdgeFormDefaults: {} };

// These defaults are only available in IE and Edge
const input = document.createElement('input');
input.type = 'submit';
text.EdgeFormDefaults.submitDefault = input.getAttribute('value');
input.type = 'reset';
text.EdgeFormDefaults.resetDefault = input.getAttribute('value');
7 changes: 6 additions & 1 deletion test/checks/shared/non-empty-if-present.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ describe('non-empty-if-present', function () {

var fixture = document.getElementById('fixture');

// These defaults are only available in IE and Edge
var input = document.createElement('input');
input.type = 'submit';
var isEdgeOrIe = typeof input.getAttribute('value') === 'string';

var checkContext = {
_data: null,
data: function (d) {
Expand Down Expand Up @@ -33,7 +38,7 @@ describe('non-empty-if-present', function () {
assert.isNull(checkContext._data);
});

it('should return false if an value is present, but empty', function () {
(isEdgeOrIe ? xit : it)('should return false if an value is present, but empty', function () {
var node = document.createElement('input');
node.setAttribute('type', 'submit');
node.setAttribute('value', '');
Expand Down

0 comments on commit 9c81f8d

Please sign in to comment.