-
Notifications
You must be signed in to change notification settings - Fork 743
/
alt-space.js
31 lines (25 loc) · 1.05 KB
/
alt-space.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
describe('alt-space-value', function() {
'use strict';
var checkSetup = axe.testUtils.checkSetup;
var checkContext = axe.testUtils.MockCheckContext();
var check = checks['alt-space-value'];
afterEach(function() {
checkContext.reset();
});
it('should return true if alt contains a space character', function() {
var params = checkSetup('<img id="target" alt=" " />');
assert.isTrue(check.evaluate.apply(checkContext, params));
});
it('should return true if alt contains a non-breaking space character', function() {
var params = checkSetup('<img id="target" alt=" " />');
assert.isTrue(check.evaluate.apply(checkContext, params));
});
it('should return false if alt attribute is empty', function() {
var params = checkSetup('<img id="target" alt="" />');
assert.isFalse(check.evaluate.apply(checkContext, params));
});
it('should return false if alt attribute has a proper text value', function() {
var params = checkSetup('<img id="target" alt="text content" />');
assert.isFalse(check.evaluate.apply(checkContext, params));
});
});