-
Notifications
You must be signed in to change notification settings - Fork 776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Color fixes: #607, #556, #596 #610
Changes from 4 commits
c473d97
d65df7b
3003dc9
0e9c124
af39be7
0a31672
875a403
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,6 +192,39 @@ describe('color.getBackgroundColor', function () { | |
assert.deepEqual(bgNodes, [target]); | ||
}); | ||
|
||
it('should return a bgcolor for a multiline inline element fully covering the background', function () { | ||
fixture.innerHTML = '<div style="position:relative;">' + | ||
'<div style="background-color:rgba(0,0,0,1);position:absolute;width:300px;height:200px;"></div>' + | ||
'<p style="position: relative;z-index:1;">Text oh heyyyy <a href="#" id="target">and here\'s <br>a link</a></p>' + | ||
'</div>'; | ||
var actual = axe.commons.color.getBackgroundColor(document.getElementById('target'), []); | ||
assert.isNotNull(actual); | ||
assert.equal(Math.round(actual.blue), 0); | ||
assert.equal(Math.round(actual.red), 0); | ||
assert.equal(Math.round(actual.green), 0); | ||
}); | ||
|
||
it('should return null for a multiline block element not fully covering the background', function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test fails in Firefox AND Phantom, which is super irritating. Essentially, this test returns an actual color even though half of the element isn't covering its parent–but in Chrome it returns null. Rather than spending more time trying to fix this case, I'm going to capture the problem in #621 and remove the test from this PR. |
||
fixture.innerHTML = '<div style="position:relative;">' + | ||
'<div id="background" style="background-color:rgba(0,0,0,1); position:absolute; width:300px; height:20px;"></div>' + | ||
'<p style="position:relative; z-index:1; width:300px;" id="target">Text content Text content Text content '+ | ||
'Text content Text content Text content</p>' + | ||
'</div>'; | ||
var actual = axe.commons.color.getBackgroundColor(document.getElementById('target'), []); | ||
assert.isNull(actual); | ||
assert.equal(axe.commons.color.incompleteData.get('bgColor'), 'elmPartiallyObscured'); | ||
}); | ||
|
||
it('should return null if a multiline inline element does not fully cover background', function () { | ||
fixture.innerHTML = '<div style="position:relative;">' + | ||
'<div style="background-color:rgba(0,0,0,1);position:absolute;width:300px;height:20px;"></div>' + | ||
'<p style="position: relative;z-index:1;">Text oh heyyyy <a href="#" id="target">and here\'s <br>a link</a></p>' + | ||
'</div>'; | ||
var actual = axe.commons.color.getBackgroundColor(document.getElementById('target'), []); | ||
assert.isNull(actual); | ||
assert.equal(axe.commons.color.incompleteData.get('bgColor'), 'elmPartiallyObscuring'); | ||
}); | ||
|
||
it('should count a TR as a background element for TD', function () { | ||
fixture.innerHTML = '<div style="background-color:#007acc;">' + | ||
'<table style="width:100%">' + | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor formatting issue here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.