(element, {index = 0} = {})
| 140 | * }} options |
| 141 | */ |
| 142 | export function assertScreenReaderElement(element, {index = 0} = {}) { |
| 143 | const offset = index * 8; |
| 144 | expect(element).to.exist; |
| 145 | expect(element.classList.contains('i-amphtml-screen-reader')).to.be.true; |
| 146 | const win = element.ownerDocument.defaultView; |
| 147 | const computedStyle = win.getComputedStyle(element); |
| 148 | expect(computedStyle.getPropertyValue('position')).to.equal('fixed'); |
| 149 | expect(computedStyle.getPropertyValue('top')).to.equal('0px'); |
| 150 | expect(computedStyle.getPropertyValue('left')).to.equal(`${offset}px`); |
| 151 | expect(computedStyle.getPropertyValue('width')).to.equal('4px'); |
| 152 | expect(computedStyle.getPropertyValue('height')).to.equal('4px'); |
| 153 | expect(computedStyle.getPropertyValue('opacity')).to.equal('0'); |
| 154 | expect(computedStyle.getPropertyValue('overflow')).to.equal('hidden'); |
| 155 | expect(computedStyle.getPropertyValue('border')).to.contain('none'); |
| 156 | expect(computedStyle.getPropertyValue('margin')).to.equal('0px'); |
| 157 | expect(computedStyle.getPropertyValue('padding')).to.equal('0px'); |
| 158 | expect(computedStyle.getPropertyValue('display')).to.equal('block'); |
| 159 | expect(computedStyle.getPropertyValue('visibility')).to.equal('visible'); |
| 160 | } |
| 161 | |
| 162 | // Use a browserId to avoid cross-browser race conditions. |
| 163 | // TODO(amphtml): Remove browserId now that we no longer test on Sauce Labs. |
no test coverage detected